6.1.2-rc1 review
Subsystems (14)
Greg Kroah-Hartman
maintainerPATCH 253/1146 can: kvaser_usb: Compare requested bittiming parameters with actual parameters in do_set_{,data}_bittiming
In reply to Greg Kroah-HartmanFrom: Jimmy Assarsson <[email protected]>
[ Upstream commit 39d3df6b0ea80f9b515c632ca07b39b1c156edee ]
The device will respond with a CMD_ERROR_EVENT command, with error_code KVASER_USB_{LEAF,HYDRA}_ERROR_EVENT_PARAM, if the CMD_SET_BUSPARAMS_REQ contains invalid bittiming parameters.
However, this command does not contain any channel reference.
To check if the CMD_SET_BUSPARAMS_REQ was successful, redback and compare the requested bittiming parameters with the device reported parameters.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 15 +- .../net/can/usb/kvaser_usb/kvaser_usb_core.c | 96 ++++++++++- .../net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 150 +++++++++++++++--- .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 64 ++++++-- 4 files changed, 284 insertions(+), 41 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb.h +12 -3
@@ -119,9 +119,12 @@ struct kvaser_usb_net_priv {struct net_device *netdev;int channel; -struct completion start_comp, stop_comp, flush_comp; +struct completion start_comp, stop_comp, flush_comp, + get_busparams_comp;struct usb_anchor tx_submitted; +struct kvaser_usb_busparams busparams_nominal, busparams_data; +spinlock_t tx_contexts_lock;/* lock for active_tx_contexts */ int active_tx_contexts;struct kvaser_usb_tx_urb_context tx_contexts[];
@@ -131,7 +134,9 @@ struct kvaser_usb_net_priv {* struct kvaser_usb_dev_ops - Device specific functions * @dev_set_mode: used for can.do_set_mode * @dev_set_bittiming: used for can.do_set_bittiming +* @dev_get_busparams: readback arbitration busparams * @dev_set_data_bittiming: used for can.do_set_data_bittiming +* @dev_get_data_busparams: readback data busparams * @dev_get_berr_counter: used for can.do_get_berr_counter * * @dev_setup_endpoints: setup USB in and out endpoints
@@ -153,8 +158,12 @@ struct kvaser_usb_net_priv {*/ struct kvaser_usb_dev_ops {int (*dev_set_mode)(struct net_device *netdev,enum can_mode mode); -int (*dev_set_bittiming)(struct net_device *netdev); -int (*dev_set_data_bittiming)(struct net_device *netdev); +int (*dev_set_bittiming)(const struct net_device *netdev, +const struct kvaser_usb_busparams *busparams); +int (*dev_get_busparams)(struct kvaser_usb_net_priv *priv); +int (*dev_set_data_bittiming)(const struct net_device *netdev, +const struct kvaser_usb_busparams *busparams); +int (*dev_get_data_busparams)(struct kvaser_usb_net_priv *priv);int (*dev_get_berr_counter)(const struct net_device *netdev,struct can_berr_counter *bec);int (*dev_setup_endpoints)(struct kvaser_usb *dev);
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +90 -6
126 lines not on this page · raw message
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +129 -21
240 lines not on this page · raw message
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +53 -11
115 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 254/1146 clk: renesas: r8a779f0: Fix SD0H clock name
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 99c05a2b710f16ea592ccb63ef5fe5f1f6b15db9 ]
Correct the misspelled textual name of the SD0H clock.
--- drivers/clk/renesas/r8a779f0-cpg-mssr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/r8a779f0-cpg-mssr.c +1 -1
@@ -113,7 +113,7 @@ static const struct cpg_core_clk r8a779f0_core_clks[] __initconst = {DEF_FIXED ("sasyncperd2" ,R8A779F0_CLK_SASYNCPERD2 ,R8A779F0_CLK_SASYNCPERD1 ,2 ,1 ),DEF_FIXED ("sasyncperd4" ,R8A779F0_CLK_SASYNCPERD4 ,R8A779F0_CLK_SASYNCPERD1 ,4 ,1 ), -DEF_GEN4_SDH ("sdh0" ,R8A779F0_CLK_SD0H ,CLK_SDSRC ,0x870 ), +DEF_GEN4_SDH ("sd0h" ,R8A779F0_CLK_SD0H ,CLK_SDSRC ,0x870 ),DEF_GEN4_SD ("sd0" ,R8A779F0_CLK_SD0 ,R8A779F0_CLK_SD0H ,0x870 ), DEF_BASE("rpc", R8A779F0_CLK_RPC, CLK_TYPE_GEN4_RPC, CLK_RPCSRC),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 255/1146 clk: renesas: r8a779a0: Fix SD0H clock name
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit db7076d5a7f0ca7dcf08f5095c74f86d4d0085ff ]
Correct the misspelled textual name of the SD0H clock.
--- drivers/clk/renesas/r8a779a0-cpg-mssr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/r8a779a0-cpg-mssr.c +1 -1
@@ -116,7 +116,7 @@ static const struct cpg_core_clk r8a779a0_core_clks[] __initconst = {DEF_FIXED ("cp" ,R8A779A0_CLK_CP ,CLK_EXTAL ,2 ,1 ),DEF_FIXED ("cl16mck" ,R8A779A0_CLK_CL16MCK ,CLK_PLL1_DIV2 ,64 ,1 ), -DEF_GEN4_SDH ("sdh0" ,R8A779A0_CLK_SD0H ,CLK_SDSRC ,0x870 ), +DEF_GEN4_SDH ("sd0h" ,R8A779A0_CLK_SD0H ,CLK_SDSRC ,0x870 ),DEF_GEN4_SD ("sd0" ,R8A779A0_CLK_SD0 ,R8A779A0_CLK_SD0H ,0x870 ), DEF_BASE("rpc", R8A779A0_CLK_RPC, CLK_TYPE_GEN4_RPC, CLK_RPCSRC),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 256/1146 ASoC: dt-bindings: rt5682: Set sound-dai-cells to 1
In reply to Greg Kroah-HartmanFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 07b16192f3f01d002d8ff37dcd4372980330ea93 ]
Commit 0adccaf1eac9 ("ASoC: dt-bindings: rt5682: Add #sound-dai-cells") defined the sound-dai-cells property as 0. However, rt5682 has two DAIs, AIF1 and AIF2, and therefore should have sound-dai-cells set to 1. Fix it.
--- Documentation/devicetree/bindings/sound/rt5682.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/rt5682.txt +1 -1
@@ -46,7 +46,7 @@ Optional properties: - realtek,dmic-clk-driving-high : Set the high driving of the DMIC clock out. -- #sound-dai-cells: Should be set to '<0>'. +- #sound-dai-cells: Should be set to '<1>'. Pins on the device (for linking into audio routes) for RT5682:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 257/1146 drm/i915/guc: Add error-capture init warnings when needed
In reply to Greg Kroah-HartmanFrom: Alan Previn <[email protected]>
[ Upstream commit a894077890ad118de88c97c03f67a611ca60882a ]
If GuC is being used and we initialized GuC-error-capture, we need to be warning if we don't provide an error-capture register list in the firmware ADS, for valid GT engines. A warning makes sense as this would impact debugability without realizing why a reglist wasn't retrieved and reported by GuC.
However, depending on the platform, we might have certain engines that have a register list for engine instance error state but not for engine class. Thus, add a check only to warn if the register list was non existent vs an empty list (use the empty lists to skip the warning).
NOTE: if a future platform were to introduce new registers in place of what was an empty list on existing / legacy hardware engines no warning is provided as the empty list is meant to be used intentionally. As an example, if a future hardware were to add blitter engine-class-registers (new) on top of the legacy blitter engine-instance-register (HEAD, TAIL, etc.), no warning is generated.
Stable-dep-of: befb231d5de2 ("drm/i915/guc: Fix GuC error capture sizing estimation and reporting")
--- .../gpu/drm/i915/gt/uc/intel_guc_capture.c | 78 ++++++++++++++++--- 1 file changed, 69 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c +69 -9
@@ -419,6 +419,44 @@ guc_capture_get_device_reglist(struct intel_guc *guc)return default_lists; } +static const char * +__stringify_type (u32 type) +{ +switch (type) { +case GUC_CAPTURE_LIST_TYPE_GLOBAL : +return "Global" ; +case GUC_CAPTURE_LIST_TYPE_ENGINE_CLASS : +return "Class" ; +case GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE : +return "Instance" ; +default : +break ; + } + +return "unknown" ; +} + +static const char * +__stringify_engclass (u32 class) +{ +switch (class) { +case GUC_RENDER_CLASS : +return "Render" ; +case GUC_VIDEO_CLASS : +return "Video" ; +case GUC_VIDEOENHANCE_CLASS : +return "VideoEnhance" ; +case GUC_BLITTER_CLASS : +return "Blitter" ; +case GUC_COMPUTE_CLASS : +return "Compute" ; +default : +break ; + } + +return "unknown" ; +} +static int guc_capture_list_init (struct intel_guc *guc,u32 owner,u32 type,u32 classid,struct guc_mmio_reg *ptr,u16 num_entries)
@@ -482,23 +520,38 @@ guc_cap_list_num_regs(struct intel_guc_state_capture *gc, u32 owner, u32 type, ureturn num_regs; } -int -intel_guc_capture_getlistsize (struct intel_guc *guc,u32 owner,u32 type,u32 classid, -size_t *size) +static int +guc_capture_getlistsize (struct intel_guc *guc,u32 owner,u32 type,u32 classid, +size_t *size,bool is_purpose_est) {struct intel_guc_state_capture *gc = guc->capture; +struct drm_i915_private *i915 =guc_to_gt (guc)->i915;struct __guc_capture_ads_cache *cache = &gc->ads_cache[owner][type][classid];int num_regs; -if (!gc->reglists) +if (!gc->reglists) { +drm_warn (&i915->drm,"GuC-capture: No reglist on this device\n" );return -ENODEV ; + }if (cache->is_valid) { *size = cache->size;return cache->status; } +if (!is_purpose_est && owner ==GUC_CAPTURE_LIST_INDEX_PF && + !guc_capture_get_one_list (gc->reglists, owner, type, classid)) { +if (type ==GUC_CAPTURE_LIST_TYPE_GLOBAL ) +drm_warn (&i915->drm,"Missing GuC-Err-Cap reglist Global!\n" ); +else +drm_warn (&i915->drm,"Missing GuC-Err-Cap reglist %s(%u):%s(%u)!\n" , +__stringify_type (type), type, +__stringify_engclass (classid), classid); +return -ENODATA ; + } + num_regs =guc_cap_list_num_regs (gc, owner, type, classid); +/* intentional empty lists can exist depending on hw config */ if (!num_regs)return -ENODATA ;
@@ -508,6 +561,13 @@ intel_guc_capture_getlistsize(struct intel_guc *guc, u32 owner, u32 type, u32 clreturn 0 ; } +int +intel_guc_capture_getlistsize (struct intel_guc *guc,u32 owner,u32 type,u32 classid, +size_t *size) +{ +return guc_capture_getlistsize (guc, owner, type, classid, size, false); +} +static void guc_capture_create_prealloc_nodes (struct intel_guc *guc);int
@@ -627,15 +687,15 @@ guc_capture_output_min_size_est(struct intel_guc *guc) worst_min_size +=sizeof (struct guc_state_capture_group_header_t ) + (3 *sizeof (struct guc_state_capture_header_t )); -if (!intel_guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_GLOBAL ,0 , &tmp)) +if (!guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_GLOBAL ,0 , &tmp, true)) num_regs += tmp; -if (!intel_guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_ENGINE_CLASS , - engine->class, &tmp)) { +if (!guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_ENGINE_CLASS , + engine->class, &tmp, true)) { num_regs += tmp; } -if (!intel_guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE , - engine->class, &tmp)) { +if (!guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE , + engine->class, &tmp, true)) { num_regs += tmp; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 258/1146 drm/i915/guc: Fix GuC error capture sizing estimation and reporting
In reply to Greg Kroah-HartmanFrom: Alan Previn <[email protected]>
[ Upstream commit befb231d5de2773f6c6f6cf918234e2e709110a5 ]
During GuC error capture initialization, we estimate the amount of size we need for the error-capture-region of the shared GuC-log-buffer. This calculation was incorrect so fix that. With the fixed calculation we can reduce the allocation of error-capture region from 4MB to 1MB (see note2 below for reasoning). Additionally, switch from drm_notice to drm_debug for the 3X spare size check since that would be impossible to hit without redesigning gpu_coredump framework to hold multiple captures.
NOTE1: Even for 1x the min size estimation case, actually running out of space is a corner case because it can only occur if all engine instances get reset all at once and i915 isn't able extract the capture data fast enough within G2H handler worker.
NOTE2: With the corrected calculation, a DG2 part required ~77K and a PVC required ~115K (1X min-est-size that is calculated as one-shot all-engine- reset scenario).
--- .../gpu/drm/i915/gt/uc/intel_guc_capture.c | 29 ++++++++++++------- drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 6 ++-- 2 files changed, 21 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c +18 -11
@@ -555,8 +555,9 @@ guc_capture_getlistsize(struct intel_guc *guc, u32 owner, u32 type, u32 classid,if (!num_regs)return -ENODATA ; - *size =PAGE_ALIGN ((sizeof (struct guc_debug_capture_list )) + - (num_regs *sizeof (struct guc_mmio_reg ))); +if (size) + *size =PAGE_ALIGN ((sizeof (struct guc_debug_capture_list )) + + (num_regs *sizeof (struct guc_mmio_reg )));return 0 ; }
@@ -666,7 +667,7 @@ guc_capture_output_min_size_est(struct intel_guc *guc)struct intel_gt *gt =guc_to_gt (guc);struct intel_engine_cs *engine;enum intel_engine_id id; -int worst_min_size =0 , num_regs =0 ; +int worst_min_size =0 ;size_t tmp =0 ;if (!guc->capture)
@@ -688,20 +689,18 @@ guc_capture_output_min_size_est(struct intel_guc *guc) (3 *sizeof (struct guc_state_capture_header_t ));if (!guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_GLOBAL ,0 , &tmp, true)) - num_regs += tmp; + worst_min_size += tmp;if (!guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_ENGINE_CLASS , engine->class, &tmp, true)) { - num_regs += tmp; + worst_min_size += tmp; }if (!guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE , engine->class, &tmp, true)) { - num_regs += tmp; + worst_min_size += tmp; } } - worst_min_size += (num_regs *sizeof (struct guc_mmio_reg )); -return worst_min_size; }
@@ -718,15 +717,23 @@ static void check_guc_capture_size(struct intel_guc *guc)int spare_size = min_size *GUC_CAPTURE_OVERBUFFER_MULTIPLIER ;u32 buffer_size =intel_guc_log_section_size_capture (&guc->log); +/* +* NOTE: min_size is much smaller than the capture region allocation (DG2: <80K vs 1MB) +* Additionally, its based on space needed to fit all engines getting reset at once +* within the same G2H handler task slot. This is very unlikely. However, if GuC really +* does run out of space for whatever reason, we will see an separate warning message +* when processing the G2H event capture-notification, search for: +* INTEL_GUC_STATE_CAPTURE_EVENT_STATUS_NOSPACE. +*/ if (min_size <0 )drm_warn (&i915->drm,"Failed to calculate GuC error state capture buffer minimum size: %d!\n" , min_size);else if (min_size > buffer_size) -drm_warn (&i915->drm,"GuC error state capture buffer is too small: %d < %d\n" , +drm_warn (&i915->drm,"GuC error state capture buffer maybe small: %d < %d\n" , buffer_size, min_size);else if (spare_size > buffer_size) -drm_notice (&i915->drm,"GuC error state capture buffer maybe too small: %d < %d (min = %d)\n" , - buffer_size, spare_size, min_size); +drm_dbg (&i915->drm,"GuC error state capture buffer lacks spare size: %d < %d (min = %d)\n" , + buffer_size, spare_size, min_size); }/*
drivers/gpu/drm/i915/gt/uc/intel_guc_log.c +3 -3
@@ -16,15 +16,15 @@#if defined(CONFIG_DRM_I915_DEBUG_GUC )#define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE SZ_2M#define GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE SZ_16M -#define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE SZ_4M +#define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE SZ_1M#elif defined(CONFIG_DRM_I915_DEBUG_GEM )#define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE SZ_1M#define GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE SZ_2M -#define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE SZ_4M +#define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE SZ_1M#else #define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE SZ_8K#define GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE SZ_64K -#define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE SZ_2M +#define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE SZ_1M#endif static void guc_log_copy_debuglogs_for_relay (struct intel_guc_log *log);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 259/1146 dw9768: Enable low-power probe on ACPI
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
[ Upstream commit 5f9a089b6de34655318afe8e544d9a9cc0fc1d29 ]
Add support for low-power probe to the driver. Also fix runtime PM API usage in the driver.
Much of the hassle comes from different factors affecting device power states during probe for ACPI and DT.
--- drivers/media/i2c/dw9768.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-)
drivers/media/i2c/dw9768.c +25 -8
@@ -414,6 +414,7 @@ static int dw9768_probe(struct i2c_client *client) {struct device *dev = &client->dev;struct dw9768 *dw9768; +bool full_power;unsigned int i;int ret;
@@ -469,13 +470,23 @@ static int dw9768_probe(struct i2c_client *client) dw9768->sd.entity.function =MEDIA_ENT_F_LENS ; +/* +* Figure out whether we're going to power up the device here. Generally +* this is done if CONFIG_PM is disabled in a DT system or the device is +* to be powered on in an ACPI system. Similarly for power off in +* remove. +*/ pm_runtime_enable (dev); -if (!pm_runtime_enabled (dev)) { + full_power = (is_acpi_node (dev_fwnode (dev)) && +acpi_dev_state_d0 (dev)) || + (is_of_node (dev_fwnode (dev)) && !pm_runtime_enabled (dev)); +if (full_power) { ret =dw9768_runtime_resume (dev);if (ret <0 ) {dev_err (dev,"failed to power on: %d\n" , ret); goto err_clean_entity; } +pm_runtime_set_active (dev); } ret =v4l2_async_register_subdev (&dw9768->sd);
@@ -484,14 +495,17 @@ static int dw9768_probe(struct i2c_client *client) goto err_power_off; } +pm_runtime_idle (dev); +return 0 ; err_power_off: -if (pm_runtime_enabled (dev)) -pm_runtime_disable (dev); -else +if (full_power) {dw9768_runtime_suspend (dev); +pm_runtime_set_suspended (dev); + } err_clean_entity: +pm_runtime_disable (dev);media_entity_cleanup (&dw9768->sd.entity); err_free_handler:v4l2_ctrl_handler_free (&dw9768->ctrls);
@@ -503,14 +517,17 @@ static void dw9768_remove(struct i2c_client *client) {struct v4l2_subdev *sd =i2c_get_clientdata (client);struct dw9768 *dw9768 =sd_to_dw9768 (sd); +struct device *dev = &client->dev;v4l2_async_unregister_subdev (&dw9768->sd);v4l2_ctrl_handler_free (&dw9768->ctrls);media_entity_cleanup (&dw9768->sd.entity); -pm_runtime_disable (&client->dev); -if (!pm_runtime_status_suspended (&client->dev)) -dw9768_runtime_suspend (&client->dev); -pm_runtime_set_suspended (&client->dev); +if ((is_acpi_node (dev_fwnode (dev)) &&acpi_dev_state_d0 (dev)) || + (is_of_node (dev_fwnode (dev)) && !pm_runtime_enabled (dev))) { +dw9768_runtime_suspend (dev); +pm_runtime_set_suspended (dev); + } +pm_runtime_disable (dev); }static const struct of_device_id dw9768_of_table[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 260/1146 drm/amd/display: wait for vblank during pipe programming
In reply to Greg Kroah-HartmanFrom: Haiyi Zhou <[email protected]>
[ Upstream commit 203ccaf586446b578909de1b763278033fb74b51 ]
[WHY]
Skipping vblank during global sync update request can result in underflow on certain displays.
[HOW]
Roll back to the previous behavior where DC waits for vblank during pipe programming.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +2 -4
@@ -1640,10 +1640,8 @@ static void dcn20_program_pipe( pipe_ctx->pipe_dlg_param.vupdate_width);if (pipe_ctx->stream->mall_stream_config.type !=SUBVP_PHANTOM ) { - pipe_ctx->stream_res.tg->funcs->wait_for_state ( - pipe_ctx->stream_res.tg,CRTC_STATE_VBLANK ); - pipe_ctx->stream_res.tg->funcs->wait_for_state ( - pipe_ctx->stream_res.tg,CRTC_STATE_VACTIVE ); + pipe_ctx->stream_res.tg->funcs->wait_for_state (pipe_ctx->stream_res.tg,CRTC_STATE_VBLANK ); + pipe_ctx->stream_res.tg->funcs->wait_for_state (pipe_ctx->stream_res.tg,CRTC_STATE_VACTIVE ); } pipe_ctx->stream_res.tg->funcs->set_vtg_params(
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 261/1146 drm/rockchip: lvds: fix PM usage counter unbalance in poweron
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 4dba27f1a14592ac4cf71c3bc1cc1fd05dea8015 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. We fix it by replacing it with the newest pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +7 -3
@@ -152,7 +152,7 @@ static int rk3288_lvds_poweron(struct rockchip_lvds *lvds)DRM_DEV_ERROR (lvds->dev,"failed to enable lvds pclk %d\n" , ret);return ret; } - ret =pm_runtime_get_sync (lvds->dev); + ret =pm_runtime_resume_and_get (lvds->dev);if (ret <0 ) {DRM_DEV_ERROR (lvds->dev,"failed to get pm runtime: %d\n" , ret);clk_disable (lvds->pclk);
@@ -336,16 +336,20 @@ static int px30_lvds_poweron(struct rockchip_lvds *lvds) {int ret; - ret =pm_runtime_get_sync (lvds->dev); + ret =pm_runtime_resume_and_get (lvds->dev);if (ret <0 ) {DRM_DEV_ERROR (lvds->dev,"failed to get pm runtime: %d\n" , ret);return ret; }/* Enable LVDS mode */ -return regmap_update_bits (lvds->grf,PX30_LVDS_GRF_PD_VO_CON1 , + ret =regmap_update_bits (lvds->grf,PX30_LVDS_GRF_PD_VO_CON1 ,PX30_LVDS_MODE_EN (1 ) |PX30_LVDS_P2S_EN (1 ),PX30_LVDS_MODE_EN (1 ) |PX30_LVDS_P2S_EN (1 )); +if (ret) +pm_runtime_put (lvds->dev); + +return ret; }static void px30_lvds_poweroff (struct rockchip_lvds *lvds)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 262/1146 drm/i915: Handle all GTs on driver (un)load paths
In reply to Greg Kroah-HartmanFrom: Tvrtko Ursulin <[email protected]>
[ Upstream commit f569ae759472fbe1f6fdddc7398360d43fdcc199 ]
This, along with the changes already landed in commit 1c66a12ab431 ("drm/i915: Handle each GT on init/release and suspend/resume") makes engines from all GTs actually known to the driver.
To accomplish this we need to sprinkle a lot of for_each_gt calls around but is otherwise pretty un-eventuful.
v2:
- Consolidate adjacent GT loops in a couple places. (Daniele)
Stable-dep-of: 1cacd6894d5f ("drm/i915/dgfx: Grab wakeref at i915_ttm_unmap_virtual")
--- drivers/gpu/drm/i915/i915_driver.c | 3 ++- drivers/gpu/drm/i915/i915_gem.c | 43 +++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +2 -1
@@ -1662,7 +1662,8 @@ static int intel_runtime_suspend(struct device *kdev)intel_runtime_pm_enable_interrupts (dev_priv); -intel_gt_runtime_resume (to_gt (dev_priv)); +for_each_gt (gt, dev_priv, i) +intel_gt_runtime_resume (gt);enable_rpm_wakeref_asserts (rpm);
drivers/gpu/drm/i915/i915_gem.c +31 -12
83 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 263/1146 drm/i915: Refactor ttm ghost obj detection
In reply to Greg Kroah-HartmanFrom: Nirmoy Das <[email protected]>
[ Upstream commit 6667d78a1123d237d66e34923754ebca97d06d39 ]
Currently i915_ttm_to_gem() returns NULL for ttm ghost object which makes it unclear when we should add a NULL check for a caller of i915_ttm_to_gem() as ttm ghost objects are expected behaviour for certain cases.
Create a separate function to detect ttm ghost object and use that in places where we expect a ghost obj from ttm.
Stable-dep-of: 1cacd6894d5f ("drm/i915/dgfx: Grab wakeref at i915_ttm_unmap_virtual")
--- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 21 ++++++++++---------- drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 18 ++++++++++++----- drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 2 +- 3 files changed, 24 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +10 -11
@@ -279,7 +279,7 @@ static struct ttm_tt *i915_ttm_tt_create(struct ttm_buffer_object *bo,struct i915_ttm_tt *i915_tt;int ret; -if (!obj) +if (i915_ttm_is_ghost_object (bo))return NULL ; i915_tt =kzalloc (sizeof (*i915_tt),GFP_KERNEL );
@@ -362,7 +362,7 @@ static bool i915_ttm_eviction_valuable(struct ttm_buffer_object *bo, {struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); -if (!obj) +if (i915_ttm_is_ghost_object (bo))return false;/*
@@ -511,7 +511,7 @@ static void i915_ttm_delete_mem_notify(struct ttm_buffer_object *bo)struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo);intel_wakeref_t wakeref =0 ; -if (bo->resource &&likely (obj)) { +if (bo->resource && !i915_ttm_is_ghost_object (bo)) {/* ttm_bo_release() already has dma_resv_lock */ if (i915_ttm_cpu_maps_iomem (bo->resource)) wakeref =intel_runtime_pm_get (&to_i915 (obj->base.dev)->runtime_pm);
@@ -628,7 +628,7 @@ static void i915_ttm_swap_notify(struct ttm_buffer_object *bo)struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo);int ret; -if (!obj) +if (i915_ttm_is_ghost_object (bo))return ; ret =i915_ttm_move_notify (bo);
@@ -661,7 +661,7 @@ static int i915_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resourcestruct drm_i915_gem_object *obj =i915_ttm_to_gem (mem->bo);bool unknown_state; -if (!obj) +if (i915_ttm_is_ghost_object (mem->bo))return -EINVAL ;if (!kref_get_unless_zero (&obj->base.refcount))
@@ -694,7 +694,7 @@ static unsigned long i915_ttm_io_mem_pfn(struct ttm_buffer_object *bo,unsigned long base;unsigned int ofs; -GEM_BUG_ON (!obj); +GEM_BUG_ON (i915_ttm_is_ghost_object (bo));GEM_WARN_ON (bo->ttm); base = obj->mm.region->iomap.base - obj->mm.region->region.start;
@@ -994,13 +994,12 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)struct vm_area_struct *area = vmf->vma;struct ttm_buffer_object *bo = area->vm_private_data;struct drm_device *dev = bo->base.dev; -struct drm_i915_gem_object *obj; +struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo);intel_wakeref_t wakeref =0 ;vm_fault_t ret;int idx; - obj =i915_ttm_to_gem (bo); -if (!obj) +if (i915_ttm_is_ghost_object (bo))return VM_FAULT_SIGBUS ;/* Sanity check that we allow writing into this object */
@@ -1098,7 +1097,7 @@ static void ttm_vm_open(struct vm_area_struct *vma)struct drm_i915_gem_object *obj =i915_ttm_to_gem (vma->vm_private_data); -GEM_BUG_ON (!obj); +GEM_BUG_ON (i915_ttm_is_ghost_object (vma->vm_private_data));i915_gem_object_get (obj); }
@@ -1107,7 +1106,7 @@ static void ttm_vm_close(struct vm_area_struct *vma)struct drm_i915_gem_object *obj =i915_ttm_to_gem (vma->vm_private_data); -GEM_BUG_ON (!obj); +GEM_BUG_ON (i915_ttm_is_ghost_object (vma->vm_private_data));i915_gem_object_put (obj); }
drivers/gpu/drm/i915/gem/i915_gem_ttm.h +13 -5
@@ -27,19 +27,27 @@ i915_gem_to_ttm(struct drm_i915_gem_object *obj)*/ void i915_ttm_bo_destroy (struct ttm_buffer_object *bo); +/** +* i915_ttm_is_ghost_object - Check if the ttm bo is a ghost object. +* @bo: Pointer to the ttm buffer object +* +* Return: True if the ttm bo is not a i915 object but a ghost ttm object, +* False otherwise. +*/ +static inline bool i915_ttm_is_ghost_object (struct ttm_buffer_object *bo) +{ +return bo->destroy != i915_ttm_bo_destroy; +} +/** * i915_ttm_to_gem - Convert a struct ttm_buffer_object to an embedding * struct drm_i915_gem_object. * -* Return: Pointer to the embedding struct ttm_buffer_object, or NULL -* if the object was not an i915 ttm object. +* Return: Pointer to the embedding struct ttm_buffer_object. */ static inline struct drm_i915_gem_object *i915_ttm_to_gem (struct ttm_buffer_object *bo) { -if (bo->destroy != i915_ttm_bo_destroy) -return NULL ; - return container_of(bo, struct drm_i915_gem_object, __do_not_access); }
drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c +1 -1
@@ -560,7 +560,7 @@ int i915_ttm_move(struct ttm_buffer_object *bo, bool evict,bool clear;int ret; -if (GEM_WARN_ON (!obj)) { +if (GEM_WARN_ON (i915_ttm_is_ghost_object (bo))) {ttm_bo_move_null (bo, dst_mem);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 264/1146 drm/i915: Encapsulate lmem rpm stuff in intel_runtime_pm
In reply to Greg Kroah-HartmanFrom: Anshuman Gupta <[email protected]>
[ Upstream commit e66c8dcf997ed54b62f754351e7129e1cc4e3cf9 ]
Runtime pm is not really per GT, therefore it make sense to move lmem_userfault_list, lmem_userfault_lock and userfault_wakeref from intel_gt to intel_runtime_pm structure, which is embedded to i915.
No functional change.
v2:
- Fixes the code comment nit. [Matt Auld]
Stable-dep-of: 1cacd6894d5f ("drm/i915/dgfx: Grab wakeref at i915_ttm_unmap_virtual")
--- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 6 +++--- drivers/gpu/drm/i915/gem/i915_gem_pm.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 8 ++++---- drivers/gpu/drm/i915/gt/intel_gt.c | 3 --- drivers/gpu/drm/i915/gt/intel_gt_types.h | 17 ----------------- drivers/gpu/drm/i915/i915_gem.c | 4 +--- drivers/gpu/drm/i915/intel_runtime_pm.c | 5 +++++ drivers/gpu/drm/i915/intel_runtime_pm.h | 22 ++++++++++++++++++++++ 8 files changed, 36 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +3 -3
@@ -413,7 +413,7 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) vma->mmo = mmo;if (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND ) -intel_wakeref_auto (&to_gt (i915)->userfault_wakeref, +intel_wakeref_auto (&i915->runtime_pm.userfault_wakeref,msecs_to_jiffies_timeout (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND ));if (write) {
@@ -589,9 +589,9 @@ void i915_gem_object_release_mmap_offset(struct drm_i915_gem_object *obj)spin_unlock (&obj->mmo.lock);if (obj->userfault_count) { -mutex_lock (&to_gt (to_i915 (obj->base.dev))->lmem_userfault_lock); +mutex_lock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock);list_del (&obj->userfault_link); -mutex_unlock (&to_gt (to_i915 (obj->base.dev))->lmem_userfault_lock); +mutex_unlock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); obj->userfault_count =0 ; } }
drivers/gpu/drm/i915/gem/i915_gem_pm.c +1 -1
@@ -24,7 +24,7 @@ void i915_gem_suspend(struct drm_i915_private *i915) {GEM_TRACE ("%s\n" ,dev_name (i915->drm.dev)); -intel_wakeref_auto (&to_gt (i915)->userfault_wakeref,0 ); +intel_wakeref_auto (&i915->runtime_pm.userfault_wakeref,0 );flush_workqueue (i915->wq);/*
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +4 -4
@@ -1059,13 +1059,13 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)/* ttm_bo_vm_reserve() already has dma_resv_lock */ if (ret ==VM_FAULT_NOPAGE && wakeref && !obj->userfault_count) { obj->userfault_count =1 ; -mutex_lock (&to_gt (to_i915 (obj->base.dev))->lmem_userfault_lock); -list_add (&obj->userfault_link, &to_gt (to_i915 (obj->base.dev))->lmem_userfault_list); -mutex_unlock (&to_gt (to_i915 (obj->base.dev))->lmem_userfault_lock); +mutex_lock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); +list_add (&obj->userfault_link, &to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_list); +mutex_unlock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); }if (wakeref &CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND ) -intel_wakeref_auto (&to_gt (to_i915 (obj->base.dev))->userfault_wakeref, +intel_wakeref_auto (&to_i915 (obj->base.dev)->runtime_pm.userfault_wakeref,msecs_to_jiffies_timeout (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND ));i915_ttm_adjust_lru (obj);
drivers/gpu/drm/i915/gt/intel_gt.c +0 -3
@@ -40,8 +40,6 @@ void intel_gt_common_init_early(struct intel_gt *gt) {spin_lock_init (gt->irq_lock); -INIT_LIST_HEAD (>->lmem_userfault_list); -mutex_init (>->lmem_userfault_lock);INIT_LIST_HEAD (>->closed_vma);spin_lock_init (>->closed_lock);
@@ -812,7 +810,6 @@ static int intel_gt_tile_setup(struct intel_gt *gt, phys_addr_t phys_addr) }intel_uncore_init_early (gt->uncore, gt); -intel_wakeref_auto_init (>->userfault_wakeref, gt->uncore->rpm); ret =intel_uncore_setup_mmio (gt->uncore, phys_addr);if (ret)
drivers/gpu/drm/i915/gt/intel_gt_types.h +0 -17
@@ -141,20 +141,6 @@ struct intel_gt {struct intel_wakeref wakeref;atomic_t user_wakeref; -/** -* Protects access to lmem usefault list. -* It is required, if we are outside of the runtime suspend path, -* access to @lmem_userfault_list requires always first grabbing the -* runtime pm, to ensure we can't race against runtime suspend. -* Once we have that we also need to grab @lmem_userfault_lock, -* at which point we have exclusive access. -* The runtime suspend path is special since it doesn't really hold any locks, -* but instead has exclusive access by virtue of all other accesses requiring -* holding the runtime pm wakeref. -*/ -struct mutex lmem_userfault_lock; -struct list_head lmem_userfault_list; -struct list_head closed_vma;spinlock_t closed_lock;/* guards the list of closed_vma */
@@ -170,9 +156,6 @@ struct intel_gt {*/ intel_wakeref_t awake; -/* Manual runtime pm autosuspend delay for user GGTT/lmem mmaps */ -struct intel_wakeref_auto userfault_wakeref; -u32 clock_frequency;u32 clock_period_ns;
drivers/gpu/drm/i915/i915_gem.c +1 -3
@@ -843,7 +843,7 @@ void i915_gem_runtime_suspend(struct drm_i915_private *i915)__i915_gem_object_release_mmap_gtt (obj);list_for_each_entry_safe (obj, on, - &to_gt (i915)->lmem_userfault_list, userfault_link) + &i915->runtime_pm.lmem_userfault_list, userfault_link)i915_gem_object_runtime_pm_release_mmap_offset (obj);/*
@@ -1227,8 +1227,6 @@ void i915_gem_driver_remove(struct drm_i915_private *dev_priv)struct intel_gt *gt;unsigned int i; -intel_wakeref_auto_fini (&to_gt (dev_priv)->userfault_wakeref); -i915_gem_suspend_late (dev_priv);for_each_gt (gt, dev_priv, i)intel_gt_driver_remove (gt);
drivers/gpu/drm/i915/intel_runtime_pm.c +5 -0
@@ -633,6 +633,8 @@ void intel_runtime_pm_driver_release(struct intel_runtime_pm *rpm) runtime_pm);int count =atomic_read (&rpm->wakeref_count); +intel_wakeref_auto_fini (&rpm->userfault_wakeref); + drm_WARN(&i915->drm, count, "i915 raw-wakerefs=%d wakelocks=%d on cleanup\n", intel_rpm_raw_wakeref_count(count),
@@ -652,4 +654,7 @@ void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm) rpm->available =HAS_RUNTIME_PM (i915);init_intel_runtime_pm_wakeref (rpm); +INIT_LIST_HEAD (&rpm->lmem_userfault_list); +mutex_init (&rpm->lmem_userfault_lock); +intel_wakeref_auto_init (&rpm->userfault_wakeref, rpm); }
drivers/gpu/drm/i915/intel_runtime_pm.h +22 -0
@@ -53,6 +53,28 @@ struct intel_runtime_pm {bool irqs_enabled;bool no_wakeref_tracking; +/* +* Protects access to lmem usefault list. +* It is required, if we are outside of the runtime suspend path, +* access to @lmem_userfault_list requires always first grabbing the +* runtime pm, to ensure we can't race against runtime suspend. +* Once we have that we also need to grab @lmem_userfault_lock, +* at which point we have exclusive access. +* The runtime suspend path is special since it doesn't really hold any locks, +* but instead has exclusive access by virtue of all other accesses requiring +* holding the runtime pm wakeref. +*/ +struct mutex lmem_userfault_lock; + +/* +* Keep list of userfaulted gem obj, which require to release their +* mmap mappings at runtime suspend path. +*/ +struct list_head lmem_userfault_list; + +/* Manual runtime pm autosuspend delay for user GGTT/lmem mmaps */ +struct intel_wakeref_auto userfault_wakeref; +#if IS_ENABLED (CONFIG_DRM_I915_DEBUG_RUNTIME_PM )/* * To aide detection of wakeref leaks and general misuse, we
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 265/1146 drm/i915/dgfx: Grab wakeref at i915_ttm_unmap_virtual
In reply to Greg Kroah-HartmanFrom: Anshuman Gupta <[email protected]>
[ Upstream commit 1cacd6894d5f4084f1581435e92d8a18d6721b25 ]
We had already grabbed the rpm wakeref at obj destruction path, but it also required to grab the wakeref when object moves. When i915_gem_object_release_mmap_offset() gets called by i915_ttm_move_notify(), it will release the mmap offset without grabbing the wakeref. We want to avoid that therefore, grab the wakeref at i915_ttm_unmap_virtual() accordingly.
While doing that also changed the lmem_userfault_lock from mutex to spinlock, as spinlock widely used for list.
Also changed if (obj->userfault_count) toGEM_BUG_ON(!obj->userfault_count).
v2:
- Removed lmem_userfault_{list,lock} from intel_gt. [Matt Auld]
--- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 19 +++++------- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 38 ++++++++++++++++-------- drivers/gpu/drm/i915/intel_runtime_pm.c | 2 +- drivers/gpu/drm/i915/intel_runtime_pm.h | 2 +- 4 files changed, 35 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +7 -12
@@ -557,11 +557,13 @@ void i915_gem_object_runtime_pm_release_mmap_offset(struct drm_i915_gem_object *drm_vma_node_unmap (&bo->base.vma_node, bdev->dev_mapping); -if (obj->userfault_count) { -/* rpm wakeref provide exclusive access */ -list_del (&obj->userfault_link); - obj->userfault_count =0 ; - } +/* +* We have exclusive access here via runtime suspend. All other callers +* must first grab the rpm wakeref. +*/ +GEM_BUG_ON (!obj->userfault_count); +list_del (&obj->userfault_link); + obj->userfault_count =0 ; }void i915_gem_object_release_mmap_offset (struct drm_i915_gem_object *obj)
@@ -587,13 +589,6 @@ void i915_gem_object_release_mmap_offset(struct drm_i915_gem_object *obj)spin_lock (&obj->mmo.lock); }spin_unlock (&obj->mmo.lock); - -if (obj->userfault_count) { -mutex_lock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); -list_del (&obj->userfault_link); -mutex_unlock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); - obj->userfault_count =0 ; - } } static struct i915_mmap_offset *
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +26 -12
@@ -509,18 +509,9 @@ static int i915_ttm_shrink(struct drm_i915_gem_object *obj, unsigned int flags)static void i915_ttm_delete_mem_notify (struct ttm_buffer_object *bo) {struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); -intel_wakeref_t wakeref =0 ;if (bo->resource && !i915_ttm_is_ghost_object (bo)) { -/* ttm_bo_release() already has dma_resv_lock */ -if (i915_ttm_cpu_maps_iomem (bo->resource)) - wakeref =intel_runtime_pm_get (&to_i915 (obj->base.dev)->runtime_pm); -__i915_gem_object_pages_fini (obj); - -if (wakeref) -intel_runtime_pm_put (&to_i915 (obj->base.dev)->runtime_pm, wakeref); -i915_ttm_free_cached_io_rsgt (obj); } }
@@ -1056,12 +1047,15 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT )) goto out_rpm; -/* ttm_bo_vm_reserve() already has dma_resv_lock */ +/* +* ttm_bo_vm_reserve() already has dma_resv_lock. +* userfault_count is protected by dma_resv lock and rpm wakeref. +*/ if (ret ==VM_FAULT_NOPAGE && wakeref && !obj->userfault_count) { obj->userfault_count =1 ; -mutex_lock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); +spin_lock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock);list_add (&obj->userfault_link, &to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_list); -mutex_unlock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); +spin_unlock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); }if (wakeref &CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND )
@@ -1127,7 +1121,27 @@ static u64 i915_ttm_mmap_offset(struct drm_i915_gem_object *obj)static void i915_ttm_unmap_virtual (struct drm_i915_gem_object *obj) { +struct ttm_buffer_object *bo =i915_gem_to_ttm (obj); +intel_wakeref_t wakeref =0 ; + +assert_object_held_shared (obj); + +if (i915_ttm_cpu_maps_iomem (bo->resource)) { + wakeref =intel_runtime_pm_get (&to_i915 (obj->base.dev)->runtime_pm); + +/* userfault_count is protected by obj lock and rpm wakeref. */ +if (obj->userfault_count) { +spin_lock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); +list_del (&obj->userfault_link); +spin_unlock (&to_i915 (obj->base.dev)->runtime_pm.lmem_userfault_lock); + obj->userfault_count =0 ; + } + } +ttm_bo_unmap_virtual (i915_gem_to_ttm (obj)); + +if (wakeref) +intel_runtime_pm_put (&to_i915 (obj->base.dev)->runtime_pm, wakeref); }static const struct drm_i915_gem_object_ops i915_gem_ttm_obj_ops = {
drivers/gpu/drm/i915/intel_runtime_pm.c +1 -1
@@ -655,6 +655,6 @@ void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm)init_intel_runtime_pm_wakeref (rpm);INIT_LIST_HEAD (&rpm->lmem_userfault_list); -mutex_init (&rpm->lmem_userfault_lock); +spin_lock_init (&rpm->lmem_userfault_lock);intel_wakeref_auto_init (&rpm->userfault_wakeref, rpm); }
drivers/gpu/drm/i915/intel_runtime_pm.h +1 -1
@@ -64,7 +64,7 @@ struct intel_runtime_pm {* but instead has exclusive access by virtue of all other accesses requiring * holding the runtime pm wakeref. */ -struct mutex lmem_userfault_lock; +spinlock_t lmem_userfault_lock;/* * Keep list of userfaulted gem obj, which require to release their
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 266/1146 clk: renesas: r9a06g032: Repair grave increment error
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 02693e11611e082e3c4d8653e8af028e43d31164 ]
If condition (clkspec.np != pd->dev.of_node) is true, then the driver ends up in an endless loop, forever, locking up the machine.
--- drivers/clk/renesas/r9a06g032-clocks.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/renesas/r9a06g032-clocks.c +1 -2
@@ -412,7 +412,7 @@ static int r9a06g032_attach_dev(struct generic_pm_domain *pd,int error;int index; -while (!of_parse_phandle_with_args (np,"clocks" ,"#clock-cells" , i, +while (!of_parse_phandle_with_args (np,"clocks" ,"#clock-cells" , i++, &clkspec)) {if (clkspec.np != pd->dev.of_node)continue ;
@@ -425,7 +425,6 @@ static int r9a06g032_attach_dev(struct generic_pm_domain *pd,if (error)return error; } - i++; }return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 267/1146 drm: lcdif: change burst size to 256B
In reply to Greg Kroah-HartmanFrom: Marco Felsch <[email protected]>
[ Upstream commit 2215cb3be5c28a1fd43036550c00c2371aeeba95 ]
If a axi bus master with a higher priority do a lot of memory access FIFO underruns can be inspected. Increase the burst size to 256B to avoid such underruns and to improve the memory access efficiency.
--- drivers/gpu/drm/mxsfb/lcdif_kms.c | 14 ++++++++++++-- drivers/gpu/drm/mxsfb/lcdif_regs.h | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/mxsfb/lcdif_kms.c +12 -2
@@ -148,8 +148,18 @@ static void lcdif_set_mode(struct lcdif_drm_private *lcdif, u32 bus_flags)CTRLDESCL0_1_WIDTH (m->hdisplay), lcdif->base + LCDC_V8_CTRLDESCL0_1); -writel (CTRLDESCL0_3_PITCH (lcdif->crtc.primary->state->fb->pitches[0 ]), - lcdif->base +LCDC_V8_CTRLDESCL0_3 ); +/* +* Undocumented P_SIZE and T_SIZE register but those written in the +* downstream kernel those registers control the AXI burst size. As of +* now there are two known values: +* 1 - 128Byte +* 2 - 256Byte +* Downstream set it to 256B burst size to improve the memory +* efficiency so set it here too. +*/ + ctrl =CTRLDESCL0_3_P_SIZE (2 ) |CTRLDESCL0_3_T_SIZE (2 ) | +CTRLDESCL0_3_PITCH (lcdif->crtc.primary->state->fb->pitches[0 ]); +writel (ctrl, lcdif->base +LCDC_V8_CTRLDESCL0_3 ); }static void lcdif_enable_controller (struct lcdif_drm_private *lcdif)
drivers/gpu/drm/mxsfb/lcdif_regs.h +4 -0
@@ -190,6 +190,10 @@#define CTRLDESCL0_1_WIDTH (n) ((n) & 0xffff)#define CTRLDESCL0_1_WIDTH_MASK GENMASK(15, 0) +#define CTRLDESCL0_3_P_SIZE (n) (((n) << 20) & CTRLDESCL0_3_P_SIZE_MASK) +#define CTRLDESCL0_3_P_SIZE_MASK GENMASK(22, 20) +#define CTRLDESCL0_3_T_SIZE (n) (((n) << 16) & CTRLDESCL0_3_T_SIZE_MASK) +#define CTRLDESCL0_3_T_SIZE_MASK GENMASK(17, 16)#define CTRLDESCL0_3_PITCH (n) ((n) & 0xffff)#define CTRLDESCL0_3_PITCH_MASK GENMASK(15, 0)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 268/1146 drm/panel/panel-sitronix-st7701: Fix RTNI calculation
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit c1cdee9b685a174fca849e1451c201a846a69318 ]
The RTNI field is multiplied by 16 and incremented by 512 before being used as the minimum number of pixel clock per horizontal line, hence it is necessary to subtract those 512 bytes from htotal and then divide the result by 16 before writing the value into the RTNI field. Fix the calculation.
--- drivers/gpu/drm/panel/panel-sitronix-st7701.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-sitronix-st7701.c +1 -1
@@ -244,7 +244,7 @@ static void st7701_init_sequence(struct st7701 *st7701)DSI_CMD2_BK0_INVSEL_ONES_MASK |FIELD_PREP (DSI_CMD2_BK0_INVSEL_NLINV_MASK , desc->nlinv),FIELD_PREP (DSI_CMD2_BK0_INVSEL_RTNI_MASK , - DIV_ROUND_UP(mode->htotal, 16))); + (clamp((u32)mode->htotal, 512U, 1008U) - 512) / 16));/* Command2, BK1 */ ST7701_DSI(st7701, DSI_CMD2BKX_SEL,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 269/1146 spi: Update reference to struct spi_controller
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
[ Upstream commit bf585ccee22faf469d82727cf375868105b362f7 ]
struct spi_master has been renamed to struct spi_controller. Update the reference in spi.rst to make it clickable again.
--- Documentation/driver-api/spi.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/driver-api/spi.rst +2 -2
@@ -25,8 +25,8 @@ hardware, which may be as simple as a set of GPIO pins or as complex as a pair of FIFOs connected to dual DMA engines on the other side of the SPI shift register (maximizing throughput). Such drivers bridge between whatever bus they sit on (often the platform bus) and SPI, and expose -the SPI side of their device as a :c:type:`struct spi_master -<spi_master>`. SPI devices are children of that master, +the SPI side of their device as a :c:type:`struct spi_controller +<spi_controller>`. SPI devices are children of that master, represented as a :c:type:`struct spi_device <spi_device>` and manufactured from :c:type:`struct spi_board_info <spi_board_info>` descriptors which are usually provided by
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 270/1146 drm/panel/panel-sitronix-st7701: Remove panel on DSI attach failure
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit c62102165dd79284d42383d2f7ed17301bd8e629 ]
In case mipi_dsi_attach() fails, call drm_panel_remove() to avoid memory leak.
--- drivers/gpu/drm/panel/panel-sitronix-st7701.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-sitronix-st7701.c +9 -1
@@ -762,7 +762,15 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi) st7701->dsi = dsi; st7701->desc = desc; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret) + goto err_attach; + +return 0 ; + +err_attach: +drm_panel_remove (&st7701->panel); +return ret; }static void st7701_dsi_remove (struct mipi_dsi_device *dsi)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 271/1146 drm/ttm: fix undefined behavior in bit shift for TTM_TT_FLAG_PRIV_POPULATED
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
[ Upstream commit 387659939c00156f8d6bab0fbc55b4eaf2b6bc5b ]
Shifting signed 32-bit value by 31 bits is undefined, so changing significant bit to unsigned. The UBSAN warning calltrace like below:
UBSAN: shift-out-of-bounds in ./include/drm/ttm/ttm_tt.h:122:26 left shift of 1 by 31 places cannot be represented in type 'int' Call Trace: <TASK> dump_stack_lvl+0x7d/0xa5 dump_stack+0x15/0x1b ubsan_epilogue+0xe/0x4e __ubsan_handle_shift_out_of_bounds+0x1e7/0x20c ttm_bo_move_memcpy+0x3b4/0x460 [ttm] bo_driver_move+0x32/0x40 [drm_vram_helper] ttm_bo_handle_move_mem+0x118/0x200 [ttm] ttm_bo_validate+0xfa/0x220 [ttm] drm_gem_vram_pin_locked+0x70/0x1b0 [drm_vram_helper] drm_gem_vram_pin+0x48/0xb0 [drm_vram_helper] drm_gem_vram_plane_helper_prepare_fb+0x53/0xe0 [drm_vram_helper] drm_gem_vram_simple_display_pipe_prepare_fb+0x26/0x30 [drm_vram_helper] drm_simple_kms_plane_prepare_fb+0x4d/0xe0 [drm_kms_helper] drm_atomic_helper_prepare_planes+0xda/0x210 [drm_kms_helper] drm_atomic_helper_commit+0xc3/0x1e0 [drm_kms_helper] drm_atomic_commit+0x9c/0x160 [drm] drm_client_modeset_commit_atomic+0x33a/0x380 [drm] drm_client_modeset_commit_locked+0x77/0x220 [drm] drm_client_modeset_commit+0x31/0x60 [drm] __drm_fb_helper_restore_fbdev_mode_unlocked+0xa7/0x170 [drm_kms_helper] drm_fb_helper_set_par+0x51/0x90 [drm_kms_helper] fbcon_init+0x316/0x790 visual_init+0x113/0x1d0 do_bind_con_driver+0x2a3/0x5c0 do_take_over_console+0xa9/0x270 do_fbcon_takeover+0xa1/0x170 do_fb_registered+0x2a8/0x340 fbcon_fb_registered+0x47/0xe0 register_framebuffer+0x294/0x4a0 __drm_fb_helper_initial_config_and_unlock+0x43c/0x880 [drm_kms_helper] drm_fb_helper_initial_config+0x52/0x80 [drm_kms_helper] drm_fbdev_client_hotplug+0x156/0x1b0 [drm_kms_helper] drm_fbdev_generic_setup+0xfc/0x290 [drm_kms_helper] bochs_pci_probe+0x6ca/0x772 [bochs] local_pci_probe+0x4d/0xb0 pci_device_probe+0x119/0x320 really_probe+0x181/0x550 __driver_probe_device+0xc6/0x220 driver_probe_device+0x32/0x100 __driver_attach+0x195/0x200 bus_for_each_dev+0xbb/0x120 driver_attach+0x27/0x30 bus_add_driver+0x22e/0x2f0 driver_register+0xa9/0x190 __pci_register_driver+0x90/0xa0 bochs_pci_driver_init+0x52/0x1000 [bochs] do_one_initcall+0x76/0x430 do_init_module+0x61/0x28a load_module+0x1f82/0x2e50 __do_sys_finit_module+0xf8/0x190 __x64_sys_finit_module+0x23/0x30 do_syscall_64+0x58/0x80 entry_SYSCALL_64_after_hwframe+0x63/0xcd </TASK>
--- include/drm/ttm/ttm_tt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/ttm/ttm_tt.h +1 -1
@@ -88,7 +88,7 @@ struct ttm_tt {#define TTM_TT_FLAG_EXTERNAL (1 << 2)#define TTM_TT_FLAG_EXTERNAL_MAPPABLE (1 << 3) -#define TTM_TT_FLAG_PRIV_POPULATED (1 << 31) +#define TTM_TT_FLAG_PRIV_POPULATED (1U << 31)uint32_t page_flags;/** @num_pages: Number of pages in the page array. */ uint32_t num_pages;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 272/1146 drm/msm/mdp5: stop overriding drvdata
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit c6122688f2652d7f8a44000ce21e84e82bae2b5e ]
The rest of the code expects that master's device drvdata is the struct msm_drm_private instance. Do not override the mdp5's drvdata.
Patchwork: https://patchwork.freedesktop.org/patch/508334/
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 32 +++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +17 -15
@@ -203,7 +203,7 @@ static int mdp5_set_split_display(struct msm_kms *kms, slave_encoder); } -static void mdp5_destroy (struct platform_device *pdev); +static void mdp5_destroy (struct mdp5_kms *mdp5_kms);static void mdp5_kms_destroy (struct msm_kms *kms) {
@@ -223,7 +223,7 @@ static void mdp5_kms_destroy(struct msm_kms *kms) }mdp_kms_destroy (&mdp5_kms->base); -mdp5_destroy (mdp5_kms->pdev); +mdp5_destroy (mdp5_kms); }#ifdef CONFIG_DEBUG_FS
@@ -519,9 +519,10 @@ static void read_mdp_hw_revision(struct mdp5_kms *mdp5_kms,struct device *dev = &mdp5_kms->pdev->dev;u32 version; -pm_runtime_get_sync (dev); +/* Manually enable the MDP5, as pm runtime isn't usable yet. */ +mdp5_enable (mdp5_kms); version =mdp5_read (mdp5_kms,REG_MDP5_HW_VERSION ); -pm_runtime_put_sync (dev); +mdp5_disable (mdp5_kms); *major =FIELD (version,MDP5_HW_VERSION_MAJOR ); *minor =FIELD (version,MDP5_HW_VERSION_MINOR );
@@ -559,6 +560,8 @@ static int mdp5_kms_init(struct drm_device *dev)int irq, i, ret; ret =mdp5_init (to_platform_device (dev->dev), dev); +if (ret) +return ret;/* priv->kms would have been populated by the MDP5 driver */ kms = priv->kms;
@@ -632,9 +635,8 @@ static int mdp5_kms_init(struct drm_device *dev)return ret; } -static void mdp5_destroy (struct platform_device *pdev) +static void mdp5_destroy (struct mdp5_kms *mdp5_kms) { -struct mdp5_kms *mdp5_kms =platform_get_drvdata (pdev);int i;if (mdp5_kms->ctlm)
@@ -648,7 +650,7 @@ static void mdp5_destroy(struct platform_device *pdev)kfree (mdp5_kms->intfs[i]);if (mdp5_kms->rpm_enabled) -pm_runtime_disable (&pdev->dev); +pm_runtime_disable (&mdp5_kms->pdev->dev);drm_atomic_private_obj_fini (&mdp5_kms->glob_state);drm_modeset_lock_fini (&mdp5_kms->glob_state_lock);
@@ -797,8 +799,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) goto fail; } -platform_set_drvdata (pdev, mdp5_kms); -spin_lock_init (&mdp5_kms->resource_lock); mdp5_kms->dev = dev;
@@ -839,9 +839,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)*/ clk_set_rate (mdp5_kms->core_clk,200000000 ); -pm_runtime_enable (&pdev->dev); - mdp5_kms->rpm_enabled = true; -read_mdp_hw_revision (mdp5_kms, &major, &minor); mdp5_kms->cfg =mdp5_cfg_init (mdp5_kms, major, minor);
@@ -893,10 +890,13 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)/* set uninit-ed kms */ priv->kms = &mdp5_kms->base.base; +pm_runtime_enable (&pdev->dev); + mdp5_kms->rpm_enabled = true; +return 0 ; fail:if (mdp5_kms) -mdp5_destroy (pdev); +mdp5_destroy (mdp5_kms);return ret; }
@@ -953,7 +953,8 @@ static int mdp5_dev_remove(struct platform_device *pdev)static __maybe_unused int mdp5_runtime_suspend (struct device *dev) {struct platform_device *pdev =to_platform_device (dev); -struct mdp5_kms *mdp5_kms =platform_get_drvdata (pdev); +struct msm_drm_private *priv =platform_get_drvdata (pdev); +struct mdp5_kms *mdp5_kms =to_mdp5_kms (to_mdp_kms (priv->kms));DBG ("" );
@@ -963,7 +964,8 @@ static __maybe_unused int mdp5_runtime_suspend(struct device *dev)static __maybe_unused int mdp5_runtime_resume (struct device *dev) {struct platform_device *pdev =to_platform_device (dev); -struct mdp5_kms *mdp5_kms =platform_get_drvdata (pdev); +struct msm_drm_private *priv =platform_get_drvdata (pdev); +struct mdp5_kms *mdp5_kms =to_mdp5_kms (to_mdp_kms (priv->kms));DBG ("" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 273/1146 ima: Handle -ESTALE returned by ima_filter_rule_match()
In reply to Greg Kroah-HartmanFrom: GUO Zihua <[email protected]>
[ Upstream commit c7423dbdbc9ecef7fff5239d144cad4b9887f4de ]
IMA relies on the blocking LSM policy notifier callback to update the LSM based IMA policy rules.
When SELinux update its policies, IMA would be notified and starts updating all its lsm rules one-by-one. During this time, -ESTALE would be returned by ima_filter_rule_match() if it is called with a LSM rule that has not yet been updated. In ima_match_rules(), -ESTALE is not handled, and the LSM rule is considered a match, causing extra files to be measured by IMA.
Fix it by re-initializing a temporary rule if -ESTALE is returned by ima_filter_rule_match(). The origin rule in the rule list would be updated by the LSM policy notifier callback.
--- security/integrity/ima/ima_policy.c | 41 ++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 9 deletions(-)
security/integrity/ima/ima_policy.c +32 -9
@@ -549,6 +549,9 @@ static bool ima_match_rules(struct ima_rule_entry *rule, const char *func_data) {int i; +bool result = false; +struct ima_rule_entry *lsm_rule = rule; +bool rule_reinitialized = false;if ((rule->flags &IMA_FUNC ) && (rule->func != func && func !=POST_SETATTR ))
@@ -610,35 +613,55 @@ static bool ima_match_rules(struct ima_rule_entry *rule,int rc =0 ;u32 osid; -if (!rule->lsm[i].rule) { -if (!rule->lsm[i].args_p) +if (!lsm_rule->lsm[i].rule) { +if (!lsm_rule->lsm[i].args_p)continue ;else return false; } + +retry:switch (i) {case LSM_OBJ_USER :case LSM_OBJ_ROLE :case LSM_OBJ_TYPE :security_inode_getsecid (inode, &osid); - rc =ima_filter_rule_match (osid, rule->lsm[i].type, + rc =ima_filter_rule_match (osid, lsm_rule->lsm[i].type, Audit_equal, - rule->lsm[i].rule); + lsm_rule->lsm[i].rule);break ;case LSM_SUBJ_USER :case LSM_SUBJ_ROLE :case LSM_SUBJ_TYPE : - rc =ima_filter_rule_match (secid, rule->lsm[i].type, + rc =ima_filter_rule_match (secid, lsm_rule->lsm[i].type, Audit_equal, - rule->lsm[i].rule); + lsm_rule->lsm[i].rule);break ;default :break ; } -if (!rc) -return false; + +if (rc == -ESTALE && !rule_reinitialized) { + lsm_rule =ima_lsm_copy_rule (rule); +if (lsm_rule) { + rule_reinitialized = true; + goto retry; + } + } +if (!rc) { + result = false; + goto out; + } } -return true; + result = true; + +out: +if (rule_reinitialized) { +for (i =0 ; i <MAX_LSM_RULES ; i++) +ima_filter_rule_free (lsm_rule->lsm[i].rule); +kfree (lsm_rule); + } +return result; }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 274/1146 drm/msm/hdmi: use devres helper for runtime PM management
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit b964444b2b64ce182495731d830499d1c588ccf6 ]
Use devm_pm_runtime_enable() to enable runtime PM. This way its effect will be reverted on device unbind/destruction.
Patchwork: https://patchwork.freedesktop.org/patch/499647/
--- drivers/gpu/drm/msm/hdmi/hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/hdmi/hdmi.c +1 -1
@@ -252,7 +252,7 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)if (hdmi->hpd_gpiod)gpiod_set_consumer_name (hdmi->hpd_gpiod,"HDMI_HPD" ); -pm_runtime_enable (&pdev->dev); +devm_pm_runtime_enable (&pdev->dev); hdmi->workq =alloc_ordered_workqueue ("msm_hdmi" ,0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 275/1146 bpf: Clobber stack slot when writing over spilled PTR_TO_BTF_ID
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit 261f4664caffdeb9dff4e83ee3c0334b1c3a552f ]
When support was added for spilled PTR_TO_BTF_ID to be accessed by helper memory access, the stack slot was not overwritten to STACK_MISC (and that too is only safe when env->allow_ptr_leaks is true).
This means that helpers who take ARG_PTR_TO_MEM and write to it may essentially overwrite the value while the verifier continues to track the slot for spilled register.
This can cause issues when PTR_TO_BTF_ID is spilled to stack, and then overwritten by helper write access, which can then be passed to BPF helpers or kfuncs.
Handle this by falling back to the case introduced in a later commit, which will also handle PTR_TO_BTF_ID along with other pointer types, i.e. cd17d38f8b28 ("bpf: Permits pointers on stack for helper calls").
Finally, include a comment on why REG_LIVE_WRITTEN is not being set when clobber is set to true. In short, the reason is that while when clobber is unset, we know that we won't be writing, when it is true, we *may* write to any of the stack slots in that range. It may be a partial or complete write, to just one or many stack slots.
We cannot be sure, hence to be conservative, we leave things as is and never set REG_LIVE_WRITTEN for any stack slot. However, clobber still needs to reset them to STACK_MISC assuming writes happened. However read marks still need to be propagated upwards from liveness point of view, as parent stack slot's contents may still continue to matter to child states.
--- kernel/bpf/verifier.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
kernel/bpf/verifier.c +5 -4
@@ -5159,10 +5159,6 @@ static int check_stack_range_initialized( goto mark; } -if (is_spilled_reg (&state->stack[spi]) && -base_type (state->stack[spi].spilled_ptr.type) ==PTR_TO_BTF_ID ) - goto mark; -if (is_spilled_reg (&state->stack[spi]) && (state->stack[spi].spilled_ptr.type ==SCALAR_VALUE || env->allow_ptr_leaks)) {
@@ -5193,6 +5189,11 @@ static int check_stack_range_initialized(mark_reg_read (env, &state->stack[spi].spilled_ptr, state->stack[spi].spilled_ptr.parent,REG_LIVE_READ64 ); +/* We do not set REG_LIVE_WRITTEN for stack slot, as we can not +* be sure that whether stack slot is written to or not. Hence, +* we must still conservatively propagate reads upwards even if +* helper may write to the entire memory range. +*/ }return update_stack_depth (env, state, min_off); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 276/1146 bpf: Fix slot type check in check_stack_write_var_off
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit f5e477a861e4a20d8a1c5f7a245f3a3c3c376b03 ]
For the case where allow_ptr_leaks is false, code is checking whether slot type is STACK_INVALID and STACK_SPILL and rejecting other cases. This is a consequence of incorrectly checking for register type instead of the slot type (NOT_INIT and SCALAR_VALUE respectively). Fix the check.
--- kernel/bpf/verifier.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
kernel/bpf/verifier.c +11 -8
@@ -3186,14 +3186,17 @@ static int check_stack_write_var_off(struct bpf_verifier_env *env, stype = &state->stack[spi].slot_type[slot %BPF_REG_SIZE ];mark_stack_slot_scratched (env, spi); -if (!env->allow_ptr_leaks - && *stype !=NOT_INIT - && *stype !=SCALAR_VALUE ) { -/* Reject the write if there's are spilled pointers in -* range. If we didn't reject here, the ptr status -* would be erased below (even though not all slots are -* actually overwritten), possibly opening the door to -* leaks. +if (!env->allow_ptr_leaks && *stype !=STACK_MISC && *stype !=STACK_ZERO ) { +/* Reject the write if range we may write to has not +* been initialized beforehand. If we didn't reject +* here, the ptr status would be erased below (even +* though not all slots are actually overwritten), +* possibly opening the door to leaks. +* +* We do however catch STACK_INVALID case below, and +* only allow reading possibly uninitialized memory +* later for CAP_PERFMON, as the write may not happen to +* that slot. */ verbose (env,"spilled ptr in range of var-offset stack write; insn %d, ptr off: %d" , insn_idx, i);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 277/1146 drm/msm/dpu1: Account for DSCs bits_per_pixel having 4 fractional bits
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit d3c1a8663d0ddb74eaa51121ccbb8340739a12a8 ]
According to the comment this DPU register contains the bits per pixel as a 6.4 fractional value, conveniently matching the contents of bits_per_pixel in struct drm_dsc_config which also uses 4 fractional bits. However, the downstream source this implementation was copy-pasted from has its bpp field stored _without_ fractional part.
This makes the entire convoluted math obsolete as it is impossible to pull those 4 fractional bits out of thin air, by somehow trying to reuse the lowest 2 bits of a non-fractional bpp (lsb = bpp % 4??).
The rest of the code merely attempts to keep the integer part a multiple of 4, which is rendered useless thanks to data |= dsc->bits_per_pixel << 12; already filling up those bits anyway (but not on downstream).
Patchwork: https://patchwork.freedesktop.org/patch/508946/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c +2 -9
@@ -42,7 +42,7 @@ static void dpu_hw_dsc_config(struct dpu_hw_dsc *hw_dsc, u32 initial_lines) {struct dpu_hw_blk_reg_map *c = &hw_dsc->hw; -u32 data, lsb, bpp; +u32 data;u32 slice_last_group_size;u32 det_thresh_flatness;bool is_cmd_mode = !(mode &DSC_MODE_VIDEO );
@@ -56,14 +56,7 @@ static void dpu_hw_dsc_config(struct dpu_hw_dsc *hw_dsc, data = (initial_lines <<20 ); data |= ((slice_last_group_size -1 ) <<18 );/* bpp is 6.4 format, 4 LSBs bits are for fractional part */ - data |= dsc->bits_per_pixel <<12 ; - lsb = dsc->bits_per_pixel %4 ; - bpp = dsc->bits_per_pixel /4 ; - bpp *=4 ; - bpp <<=4 ; - bpp |= lsb; - - data |= bpp <<8 ; + data |= (dsc->bits_per_pixel <<8 ); data |= (dsc->block_pred_enable <<7 ); data |= (dsc->line_buf_depth <<3 ); data |= (dsc->simple_422 <<2 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 278/1146 drm/msm/dsi: Remove useless math in DSC calculations
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 01a907980e0be3310f18c7d4955968f3b28e7147 ]
Multiplying a value by 2 and adding 1 to it always results in a value that is uneven, and that 1 gets truncated immediately when performing integer division by 2 again. There is no "rounding" possible here.
After that target_bpp_x16 is used to store a multiplication of bits_per_pixel by 16 which is only ever read to immediately be divided by 16 again, and is elided in much the same way.
Patchwork: https://patchwork.freedesktop.org/patch/508932/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -9
@@ -1762,7 +1762,6 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)int hrd_delay;int pre_num_extra_mux_bits, num_extra_mux_bits;int slice_bits; -int target_bpp_x16;int data;int final_value, final_scale;int i;
@@ -1842,14 +1841,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc) data =2048 * (dsc->rc_model_size - dsc->initial_offset + num_extra_mux_bits); dsc->slice_bpg_offset =DIV_ROUND_UP (data, groups_total); -/* bpp * 16 + 0.5 */ - data = dsc->bits_per_pixel *16 ; - data *=2 ; - data++; - data /=2 ; - target_bpp_x16 = data; - - data = (dsc->initial_xmit_delay * target_bpp_x16) /16 ; + data = dsc->initial_xmit_delay * dsc->bits_per_pixel; final_value = dsc->rc_model_size - data + num_extra_mux_bits; dsc->final_offset = final_value;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 279/1146 drm/msm/dsi: Remove repeated calculation of slice_per_intf
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 170ffca836dd9f1a0219c4f67554d408fa2b5912 ]
slice_per_intf is already computed for intf_width, which holds the same value as hdisplay.
Patchwork: https://patchwork.freedesktop.org/patch/508933/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -4
@@ -842,7 +842,7 @@ static void dsi_ctrl_config(struct msm_dsi_host *msm_host, bool enable,static void dsi_update_dsc_timing (struct msm_dsi_host *msm_host,bool is_cmd_mode,u32 hdisplay) {struct drm_dsc_config *dsc = msm_host->dsc; -u32 reg, intf_width, reg_ctrl, reg_ctrl2; +u32 reg, reg_ctrl, reg_ctrl2;u32 slice_per_intf, total_bytes_per_intf;u32 pkt_per_line;u32 bytes_in_slice;
@@ -851,8 +851,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod/* first calculate dsc parameters and then program * compress mode registers */ - intf_width = hdisplay; - slice_per_intf =DIV_ROUND_UP (intf_width, dsc->slice_width); + slice_per_intf =DIV_ROUND_UP (hdisplay, dsc->slice_width);/* If slice_per_pkt is greater than slice_per_intf * then default to 1. This can happen during partial
@@ -861,7 +860,6 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_modif (slice_per_intf > dsc->slice_count) dsc->slice_count =1 ; - slice_per_intf =DIV_ROUND_UP (hdisplay, dsc->slice_width); bytes_in_slice =DIV_ROUND_UP (dsc->slice_width * dsc->bits_per_pixel,8 ); dsc->slice_chunk_size = bytes_in_slice;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 280/1146 drm/msm/dsi: Use DIV_ROUND_UP instead of conditional increment on modulo
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 1e8196103bd02a396b45c8f6188541634a47fce2 ]
This exact same math is used to compute bytes_in_slice above in dsi_update_dsc_timing(), also used to fill slice_chunk_size.
Patchwork: https://patchwork.freedesktop.org/patch/508935/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -3
@@ -1807,9 +1807,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)* params are calculated */ groups_per_line =DIV_ROUND_UP (dsc->slice_width,3 ); - dsc->slice_chunk_size = dsc->slice_width * dsc->bits_per_pixel /8 ; -if ((dsc->slice_width * dsc->bits_per_pixel) %8 ) - dsc->slice_chunk_size++; + dsc->slice_chunk_size =DIV_ROUND_UP (dsc->slice_width * dsc->bits_per_pixel,8 );/* rbs-min */ min_rate_buffer_size = dsc->rc_model_size - dsc->initial_offset +
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 281/1146 drm/msm/dsi: Reuse earlier computed dsc->slice_chunk_size
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit e443459e2e6b8e0d3187dd0d09ef7fcea87531d2 ]
dsi_populate_dsc_params() is called prior to dsi_update_dsc_timing() and already computes a value for slice_chunk_size, whose value doesn't need to be recomputed and re-set here.
Patchwork: https://patchwork.freedesktop.org/patch/508934/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -7
@@ -845,7 +845,6 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_modu32 reg, reg_ctrl, reg_ctrl2;u32 slice_per_intf, total_bytes_per_intf;u32 pkt_per_line; -u32 bytes_in_slice;u32 eol_byte_num;/* first calculate dsc parameters and then program
@@ -860,11 +859,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_modif (slice_per_intf > dsc->slice_count) dsc->slice_count =1 ; - bytes_in_slice =DIV_ROUND_UP (dsc->slice_width * dsc->bits_per_pixel,8 ); - - dsc->slice_chunk_size = bytes_in_slice; - - total_bytes_per_intf = bytes_in_slice * slice_per_intf; + total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf; eol_byte_num = total_bytes_per_intf %3 ; pkt_per_line = slice_per_intf / dsc->slice_count;
@@ -890,7 +885,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod reg_ctrl |= reg; reg_ctrl2 &= ~DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH__MASK ; - reg_ctrl2 |=DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH (bytes_in_slice); + reg_ctrl2 |=DSI_COMMAND_COMPRESSION_MODE_CTRL2_STREAM0_SLICE_WIDTH (dsc->slice_chunk_size);dsi_write (msm_host,REG_DSI_COMMAND_COMPRESSION_MODE_CTRL , reg_ctrl);dsi_write (msm_host,REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2 , reg_ctrl2);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 282/1146 drm/msm/dsi: Appropriately set dsc->mux_word_size based on bpc
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 0ca870ca304d3449b2ccdc3f0bad9843ff1519f0 ]
This field is currently unread but will come into effect when duplicated code below is migrated to call drm_dsc_compute_rc_parameters(), which uses the bpc-dependent value of the local variable mux_words_size in much the same way.
The hardcoded constant seems to be a remnant from the /* bpc 8 */ comment right above, indicating that this group of field assignments is applicable to bpc = 8 exclusively and should probably bail out on different bpc values, until constants for other bpc values are added (or the current ones are confirmed to be correct across multiple bpc's).
Patchwork: https://patchwork.freedesktop.org/patch/508943/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -1
@@ -1786,6 +1786,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)if (dsc->bits_per_component ==12 ) mux_words_size =64 ; + dsc->mux_word_size = mux_words_size; dsc->initial_xmit_delay =512 ; dsc->initial_scale_value =32 ; dsc->first_line_bpg_offset =12 ;
@@ -1796,7 +1797,6 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc) dsc->flatness_max_qp =12 ; dsc->rc_quant_incr_limit0 =11 ; dsc->rc_quant_incr_limit1 =11 ; - dsc->mux_word_size =DSC_MUX_WORD_SIZE_8_10_BPC ;/* FIXME: need to call drm_dsc_compute_rc_parameters() so that rest of * params are calculated
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 283/1146 drm/msm/dsi: Migrate to drm_dsc_compute_rc_parameters()
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit c3a1aabce2d4087255de90100c3dad492e7d925c ]
As per the FIXME this code is entirely duplicate with what is already provided inside drm_dsc_compute_rc_parameters(), supposedly because that function was yielding "incorrect" results while in reality the panel driver(s?) used for testing were providing incorrect parameters.
For example, this code from downstream assumed dsc->bits_per_pixel to contain an integer value, whereas the upstream drm_dsc_config struct stores it with 4 fractional bits. drm_dsc_compute_rc_parameters() already accounts for this feat while the panel driver used for testing
[1] wasn't, hence making drm_dsc_compute_rc_parameters() seem like it was returning an incorrect result.
Other users of dsc->bits_per_pixel inside dsi_populate_dsc_params() also treat it in the same erroneous way, and will be addressed in a separate patch.
In the end, using drm_dsc_compute_rc_parameters() spares both a lot of duplicate code and erratic behaviour.
Patchwork: https://patchwork.freedesktop.org/patch/508939/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 64 +++--------------------------- 1 file changed, 6 insertions(+), 58 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +6 -58
@@ -21,6 +21,7 @@#include <video/mipi_display.h> +#include <drm/display/drm_dsc_helper.h> #include <drm/drm_of.h> #include "dsi.h"
@@ -1749,14 +1750,6 @@ static char bpg_offset[DSC_NUM_BUF_RANGES] = {static int dsi_populate_dsc_params (struct drm_dsc_config *dsc) { -int mux_words_size; -int groups_per_line, groups_total; -int min_rate_buffer_size; -int hrd_delay; -int pre_num_extra_mux_bits, num_extra_mux_bits; -int slice_bits; -int data; -int final_value, final_scale;int i; dsc->rc_model_size =8192 ;
@@ -1782,11 +1775,11 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)if (dsc->bits_per_pixel !=8 ) dsc->initial_offset =2048 ;/* bpp = 12 */ - mux_words_size =48 ;/* bpc == 8/10 */ -if (dsc->bits_per_component ==12 ) - mux_words_size =64 ; +if (dsc->bits_per_component <=10 ) + dsc->mux_word_size =DSC_MUX_WORD_SIZE_8_10_BPC ; +else + dsc->mux_word_size =DSC_MUX_WORD_SIZE_12_BPC ; - dsc->mux_word_size = mux_words_size; dsc->initial_xmit_delay =512 ; dsc->initial_scale_value =32 ; dsc->first_line_bpg_offset =12 ;
@@ -1798,52 +1791,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc) dsc->rc_quant_incr_limit0 =11 ; dsc->rc_quant_incr_limit1 =11 ; -/* FIXME: need to call drm_dsc_compute_rc_parameters() so that rest of -* params are calculated -*/ - groups_per_line =DIV_ROUND_UP (dsc->slice_width,3 ); - dsc->slice_chunk_size =DIV_ROUND_UP (dsc->slice_width * dsc->bits_per_pixel,8 ); - -/* rbs-min */ - min_rate_buffer_size = dsc->rc_model_size - dsc->initial_offset + - dsc->initial_xmit_delay * dsc->bits_per_pixel + - groups_per_line * dsc->first_line_bpg_offset; - - hrd_delay =DIV_ROUND_UP (min_rate_buffer_size, dsc->bits_per_pixel); - - dsc->initial_dec_delay = hrd_delay - dsc->initial_xmit_delay; - - dsc->initial_scale_value =8 * dsc->rc_model_size / - (dsc->rc_model_size - dsc->initial_offset); - - slice_bits =8 * dsc->slice_chunk_size * dsc->slice_height; - - groups_total = groups_per_line * dsc->slice_height; - - data = dsc->first_line_bpg_offset *2048 ; - - dsc->nfl_bpg_offset =DIV_ROUND_UP (data, (dsc->slice_height -1 )); - - pre_num_extra_mux_bits =3 * (mux_words_size + (4 * dsc->bits_per_component +4 ) -2 ); - - num_extra_mux_bits = pre_num_extra_mux_bits - (mux_words_size - - ((slice_bits - pre_num_extra_mux_bits) % mux_words_size)); - - data =2048 * (dsc->rc_model_size - dsc->initial_offset + num_extra_mux_bits); - dsc->slice_bpg_offset =DIV_ROUND_UP (data, groups_total); - - data = dsc->initial_xmit_delay * dsc->bits_per_pixel; - final_value = dsc->rc_model_size - data + num_extra_mux_bits; - dsc->final_offset = final_value; - - final_scale =8 * dsc->rc_model_size / (dsc->rc_model_size - final_value); - - data = (final_scale -9 ) * (dsc->nfl_bpg_offset + dsc->slice_bpg_offset); - dsc->scale_increment_interval = (2048 * dsc->final_offset) / data; - - dsc->scale_decrement_interval = groups_per_line / (dsc->initial_scale_value -8 ); - -return 0 ; +return drm_dsc_compute_rc_parameters (dsc); }static int dsi_host_parse_dt (struct msm_dsi_host *msm_host)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 284/1146 drm/msm/dsi: Account for DSCs bits_per_pixel having 4 fractional bits
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit d2c277c61986942e99680cb67ce26423d0f42f11 ]
drm_dsc_config's bits_per_pixel field holds a fractional value with 4 bits, which all panel drivers should adhere to for drm_dsc_pps_payload_pack() to generate a valid payload. All code in the DSI driver here seems to assume that this field doesn't contain any fractional bits, hence resulting in the wrong values being computed. Since none of the calculations leave any room for fractional bits or seem to indicate any possible area of support, disallow such values altogether. calculate_rc_params() in intel_vdsc.c performs an identical bitshift to get at this integer value.
Patchwork: https://patchwork.freedesktop.org/patch/508938/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +14 -5
@@ -34,7 +34,7 @@#define DSI_RESET_TOGGLE_DELAY_MS 20 -static int dsi_populate_dsc_params (struct drm_dsc_config *dsc); +static int dsi_populate_dsc_params (struct msm_dsi_host *msm_host,struct drm_dsc_config *dsc);static int dsi_get_version (const void __iomem *base,u32 *major,u32 *minor) {
@@ -909,6 +909,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)u32 va_end = va_start + mode->vdisplay;u32 hdisplay = mode->hdisplay;u32 wc; +int ret;DBG ("" );
@@ -944,7 +945,9 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)/* we do the calculations for dsc parameters here so that * panel can use these parameters */ -dsi_populate_dsc_params (dsc); + ret =dsi_populate_dsc_params (msm_host, dsc); +if (ret) +return ;/* Divide the display by 3 but keep back/font porch and * pulse width same
@@ -1748,9 +1751,15 @@ static char bpg_offset[DSC_NUM_BUF_RANGES] = {2 ,0 ,0 ,-2 ,-4 ,-6 ,-8 ,-8 ,-8 ,-10 ,-10 ,-12 ,-12 ,-12 ,-12 }; -static int dsi_populate_dsc_params (struct drm_dsc_config *dsc) +static int dsi_populate_dsc_params (struct msm_dsi_host *msm_host,struct drm_dsc_config *dsc) {int i; +u16 bpp = dsc->bits_per_pixel >>4 ; + +if (dsc->bits_per_pixel &0xf ) { +DRM_DEV_ERROR (&msm_host->pdev->dev,"DSI does not support fractional bits_per_pixel\n" ); +return -EINVAL ; + } dsc->rc_model_size =8192 ; dsc->first_line_bpg_offset =12 ;
@@ -1771,8 +1780,8 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc) dsc->rc_range_params[i].range_bpg_offset = bpg_offset[i]; } - dsc->initial_offset =6144 ;/* Not bpp 12 */ -if (dsc->bits_per_pixel !=8 ) + dsc->initial_offset =6144 ;/* Not bpp 12 */ +if (bpp !=8 ) dsc->initial_offset =2048 ;/* bpp = 12 */ if (dsc->bits_per_component <=10 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 285/1146 drm/msm/dsi: Disallow 8 BPC DSC configuration for alternative BPC values
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit d053fbc449c47517b1f6516dbce2f917f2a9f51d ]
According to the /* bpc 8 */ comment below only values for a bits_per_component of 8 are currently hardcoded in place. This is further confirmed by downstream sources [1] containing different constants for other BPC values (and different initial_offset too, with an extra dependency on bits_per_pixel). Prevent future mishaps by explicitly disallowing any other bits_per_component value until the right parameters are put in place and tested.
Patchwork: https://patchwork.freedesktop.org/patch/508942/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/dsi/dsi_host.c +5 -0
@@ -1761,6 +1761,11 @@ static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct drm_dscreturn -EINVAL ; } +if (dsc->bits_per_component !=8 ) { +DRM_DEV_ERROR (&msm_host->pdev->dev,"DSI does not support bits_per_component != 8 yet\n" ); +return -EOPNOTSUPP ; + } + dsc->rc_model_size =8192 ; dsc->first_line_bpg_offset =12 ; dsc->rc_edge_factor =6 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 286/1146 drm/msm/dsi: Prevent signed BPG offsets from bleeding into adjacent bits
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit cc84b66be223d36a3d10d59d68ba647e72db3099 ]
The bpg_offset array contains negative BPG offsets which fill the full 8 bits of a char thanks to two's complement: this however results in those bits bleeding into the next field when the value is packed into DSC PPS by the drm_dsc_helper function, which only expects range_bpg_offset to contain 6-bit wide values. As a consequence random slices appear corrupted on-screen (tested on a Sony Tama Akatsuki device with sdm845).
Use AND operators to limit these two's complement values to 6 bits, similar to the AMD and i915 drivers.
Patchwork: https://patchwork.freedesktop.org/patch/508941/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +5 -1
@@ -1782,7 +1782,11 @@ static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct drm_dscfor (i =0 ; i <DSC_NUM_BUF_RANGES ; i++) { dsc->rc_range_params[i].range_min_qp = min_qp[i]; dsc->rc_range_params[i].range_max_qp = max_qp[i]; - dsc->rc_range_params[i].range_bpg_offset = bpg_offset[i]; +/* +* Range BPG Offset contains two's-complement signed values that fill +* 8 bits, yet the registers and DCS PPS field are only 6 bits wide. +*/ + dsc->rc_range_params[i].range_bpg_offset = bpg_offset[i] &DSC_RANGE_BPG_OFFSET_MASK ; } dsc->initial_offset =6144 ;/* Not bpp 12 */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 287/1146 media: platform: mtk-mdp3: fix error handling in mdp_cmdq_send()
In reply to Greg Kroah-HartmanFrom: Moudy Ho <[email protected]>
[ Upstream commit 64e0a0804b1a7a77ee364f44ffa6a8e0e7b157d2 ]
Increase and refine the goto label in mdp_cmdq_send() to avoid double free and facilitate traceability.
Also, remove redundant work queue event in blocking function mdp_cmdq_send().
--- .../platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-)
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +26 -21
@@ -252,10 +252,9 @@ static int mdp_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *pkt,dma_addr_t dma_addr; pkt->va_base =kzalloc (size,GFP_KERNEL ); -if (!pkt->va_base) { -kfree (pkt); +if (!pkt->va_base)return -ENOMEM ; - } + pkt->buf_size = size; pkt->cl = (void *)client;
@@ -368,25 +367,30 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) cmd =kzalloc (sizeof (*cmd),GFP_KERNEL );if (!cmd) { ret = -ENOMEM ; - goto err_cmdq_data; + goto err_cancel_job; } -if (mdp_cmdq_pkt_create (mdp->cmdq_clt, &cmd->pkt,SZ_16K )) { - ret = -ENOMEM ; - goto err_cmdq_data; - } + ret =mdp_cmdq_pkt_create (mdp->cmdq_clt, &cmd->pkt,SZ_16K ); +if (ret) + goto err_free_cmd; comps =kcalloc (param->config->num_components,sizeof (*comps),GFP_KERNEL );if (!comps) { ret = -ENOMEM ; - goto err_cmdq_data; + goto err_destroy_pkt; } path =kzalloc (sizeof (*path),GFP_KERNEL );if (!path) { ret = -ENOMEM ; - goto err_cmdq_data; + goto err_free_comps; + } + + ret =mtk_mutex_prepare (mdp->mdp_mutex[MDP_PIPE_RDMA0 ]); +if (ret) { +dev_err (dev,"Fail to enable mutex clk\n" ); + goto err_free_path; } path->mdp_dev = mdp;
@@ -406,15 +410,13 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) ret =mdp_path_ctx_init (mdp, path);if (ret) {dev_err (dev,"mdp_path_ctx_init error\n" ); - goto err_cmdq_data; + goto err_free_path; } -mtk_mutex_prepare (mdp->mdp_mutex[MDP_PIPE_RDMA0 ]); - ret =mdp_path_config (mdp, cmd, path);if (ret) {dev_err (dev,"mdp_path_config error\n" ); - goto err_cmdq_data; + goto err_free_path; }cmdq_pkt_finalize (&cmd->pkt);
@@ -433,7 +435,7 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) ret =mdp_comp_clocks_on (&mdp->pdev->dev, cmd->comps, cmd->num_comps);if (ret) {dev_err (dev,"comp %d failed to enable clock!\n" , ret); - goto err_clock_off; + goto err_free_path; } dma_sync_single_for_device(mdp->cmdq_clt->chan->mbox->dev,
@@ -450,17 +452,20 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param)return 0 ; err_clock_off: -mtk_mutex_unprepare (mdp->mdp_mutex[MDP_PIPE_RDMA0 ]);mdp_comp_clocks_off (&mdp->pdev->dev, cmd->comps, cmd->num_comps); -err_cmdq_data: +err_free_path: +mtk_mutex_unprepare (mdp->mdp_mutex[MDP_PIPE_RDMA0 ]);kfree (path); -atomic_dec (&mdp->job_count); -wake_up (&mdp->callback_wq); -if (cmd && cmd->pkt.buf_size >0 ) -mdp_cmdq_pkt_destroy (&cmd->pkt); +err_free_comps:kfree (comps); +err_destroy_pkt: +mdp_cmdq_pkt_destroy (&cmd->pkt); +err_free_cmd:kfree (cmd); +err_cancel_job: +atomic_dec (&mdp->job_count); +return ret; }EXPORT_SYMBOL_GPL (mdp_cmdq_send);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 288/1146 media: platform: mtk-mdp3: fix error handling about components clock_on
In reply to Greg Kroah-HartmanFrom: Moudy Ho <[email protected]>
[ Upstream commit 74a596e7fca6d240d61def5f448e55c256c12fed ]
Add goto statement in mdp_comp_clock_on() to avoid error code not being propagated or returning positive values.
This change also performs a well-timed clock_off when an error occurs, and reduces unnecessary error logging in mdp_cmdq_send().
--- .../platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 4 +--- .../platform/mediatek/mdp3/mtk-mdp3-comp.c | 24 ++++++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-)
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +1 -3
@@ -433,10 +433,8 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct mdp_cmdq_param *param) cmd->mdp_ctx = param->mdp_ctx; ret =mdp_comp_clocks_on (&mdp->pdev->dev, cmd->comps, cmd->num_comps); -if (ret) { -dev_err (dev,"comp %d failed to enable clock!\n" , ret); +if (ret) goto err_free_path; - } dma_sync_single_for_device(mdp->cmdq_clt->chan->mbox->dev, cmd->pkt.pa_base, cmd->pkt.cmd_buf_size,
drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c +18 -6
@@ -699,12 +699,22 @@ int mdp_comp_clock_on(struct device *dev, struct mdp_comp *comp)dev_err (dev,"Failed to enable clk %d. type:%d id:%d\n" , i, comp->type, comp->id); -pm_runtime_put (comp->comp_dev); -return ret; + goto err_revert; } }return 0 ; + +err_revert: +while (--i >=0 ) { +if (IS_ERR_OR_NULL (comp->clks[i])) +continue ; +clk_disable_unprepare (comp->clks[i]); + } +if (comp->comp_dev) +pm_runtime_put_sync (comp->comp_dev); + +return ret; }void mdp_comp_clock_off (struct device *dev,struct mdp_comp *comp)
@@ -723,11 +733,13 @@ void mdp_comp_clock_off(struct device *dev, struct mdp_comp *comp)int mdp_comp_clocks_on (struct device *dev,struct mdp_comp *comps,int num) { -int i; +int i, ret; -for (i =0 ; i < num; i++) -if (mdp_comp_clock_on (dev, &comps[i]) !=0 ) -return ++i; +for (i =0 ; i < num; i++) { + ret =mdp_comp_clock_on (dev, &comps[i]); +if (ret) +return ret; + }return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 289/1146 media: platform: mtk-mdp3: fix error handling in mdp_probe()
In reply to Greg Kroah-HartmanFrom: Moudy Ho <[email protected]>
[ Upstream commit 82b7d4b5d393d6654148e885efca0a3df63806f6 ]
Adjust label "err_return" order to avoid double freeing, and add two labels for easy traceability.
--- .../media/platform/mediatek/mdp3/mtk-mdp3-core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c +8 -7
@@ -196,27 +196,27 @@ static int mdp_probe(struct platform_device *pdev) mm_pdev =__get_pdev_by_id (pdev,MDP_INFRA_MMSYS );if (!mm_pdev) { ret = -ENODEV ; - goto err_return; + goto err_destroy_device; } mdp->mdp_mmsys = &mm_pdev->dev; mm_pdev =__get_pdev_by_id (pdev,MDP_INFRA_MUTEX );if (WARN_ON (!mm_pdev)) { ret = -ENODEV ; - goto err_return; + goto err_destroy_device; }for (i =0 ; i <MDP_PIPE_MAX ; i++) { mdp->mdp_mutex[i] =mtk_mutex_get (&mm_pdev->dev);if (!mdp->mdp_mutex[i]) { ret = -ENODEV ; - goto err_return; + goto err_free_mutex; } } ret =mdp_comp_config (mdp);if (ret) {dev_err (dev,"Failed to config mdp components\n" ); - goto err_return; + goto err_free_mutex; } mdp->job_wq =alloc_workqueue (MDP_MODULE_NAME ,WQ_FREEZABLE ,0 );
@@ -287,11 +287,12 @@ static int mdp_probe(struct platform_device *pdev)destroy_workqueue (mdp->job_wq); err_deinit_comp:mdp_comp_destroy (mdp); -err_return: +err_free_mutex:for (i =0 ; i <MDP_PIPE_MAX ; i++) -if (mdp) -mtk_mutex_put (mdp->mdp_mutex[i]); +mtk_mutex_put (mdp->mdp_mutex[i]); +err_destroy_device:kfree (mdp); +err_return:dev_dbg (dev,"Errno %d\n" , ret);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 290/1146 media: rkvdec: Add required padding
In reply to Greg Kroah-HartmanFrom: Andrzej Pietrasiewicz <[email protected]>
[ Upstream commit 00c47aa85bb26450edc6059c3d245de062e60b5d ]
The addresses of two elements of the segmap[][] member are passed to the hardware which expects 128-bit aligned addresses. However, without this patch offsetof(struct rkvdec_vp9_priv_tbl, segmap[0]) is an odd number (2421) but the hardware just ignores the 5 least significant bits of the address. As a result, the hardware writes the segmentation map to incorrect locations.
Inserting 11 bytes of padding corrects this situation by making the said addresses divisible by 16 (i.e. aligned on a 128-bit boundary).
--- drivers/staging/media/rkvdec/rkvdec-vp9.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/media/rkvdec/rkvdec-vp9.c +3 -0
@@ -84,6 +84,8 @@ struct rkvdec_vp9_probs {struct rkvdec_vp9_inter_frame_probs inter;struct rkvdec_vp9_intra_only_frame_probs intra_only; }; +/* 128 bit alignment */ +u8 padding1[11 ]; };/* Data structure describing auxiliary buffer format. */
@@ -1006,6 +1008,7 @@ static int rkvdec_vp9_start(struct rkvdec_ctx *ctx) ctx->priv = vp9_ctx; +BUILD_BUG_ON (sizeof (priv_tbl->probs) %16 );/* ensure probs size is 128-bit aligned */ priv_tbl =dma_alloc_coherent (rkvdec->dev,sizeof (*priv_tbl), &vp9_ctx->priv_tbl.dma,GFP_KERNEL );if (!priv_tbl) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 291/1146 media: vivid: fix compose size exceed boundary
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
[ Upstream commit 94a7ad9283464b75b12516c5512541d467cefcf8 ]
syzkaller found a bug:
BUG: unable to handle page fault for address: ffffc9000a3b1000 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 100000067 P4D 100000067 PUD 10015f067 PMD 1121ca067 PTE 0 Oops: 0002 [#1] PREEMPT SMP CPU: 0 PID: 23489 Comm: vivid-000-vid-c Not tainted 6.1.0-rc1+ #512 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:memcpy_erms+0x6/0x10 [...] Call Trace: <TASK> ? tpg_fill_plane_buffer+0x856/0x15b0 vivid_fillbuff+0x8ac/0x1110 vivid_thread_vid_cap_tick+0x361/0xc90 vivid_thread_vid_cap+0x21a/0x3a0 kthread+0x143/0x180 ret_from_fork+0x1f/0x30 </TASK>
This is because we forget to check boundary after adjust compose->height int V4L2_SEL_TGT_CROP case. Add v4l2_rect_map_inside() to fix this problem for this case.
--- drivers/media/test-drivers/vivid/vivid-vid-cap.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/test-drivers/vivid/vivid-vid-cap.c +1 -0
@@ -973,6 +973,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selectionif (dev->has_compose_cap) {v4l2_rect_set_min_size (compose, &min_rect);v4l2_rect_set_max_size (compose, &max_rect); +v4l2_rect_map_inside (compose, &fmt); } dev->fmt_cap_rect = fmt;tpg_s_buf_height (&dev->tpg, fmt.height);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 292/1146 media: platform: exynos4-is: fix return value check in fimc_md_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit e38e42c078da4af962d322b97e726dcb2f184e3f ]
devm_pinctrl_get() may return ERR_PTR(-EPROBE_DEFER), add a minus sign to fix it.
--- drivers/media/platform/samsung/exynos4-is/media-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/samsung/exynos4-is/media-dev.c +1 -1
@@ -1472,7 +1472,7 @@ static int fimc_md_probe(struct platform_device *pdev) pinctrl =devm_pinctrl_get (dev);if (IS_ERR (pinctrl)) { ret =PTR_ERR (pinctrl); -if (ret !=EPROBE_DEFER ) +if (ret != -EPROBE_DEFER )dev_err (dev,"Failed to get pinctrl: %d\n" , ret); goto err_clk; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 293/1146 bpf: propagate precision in ALU/ALU64 operations
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit a3b666bfa9c9edc05bca62a87abafe0936bd7f97 ]
When processing ALU/ALU64 operations (apart from BPF_MOV, which is handled correctly already; and BPF_NEG and BPF_END are special and don't have source register), if destination register is already marked precise, this causes problem with potentially missing precision tracking for the source register. E.g., when we have r1 >>= r5 and r1 is marked precise, but r5 isn't, this will lead to r5 staying as imprecise. This is due to the precision backtracking logic stopping early when it sees r1 is already marked precise. If r1 wasn't precise, we'd keep backtracking and would add r5 to the set of registers that need to be marked precise. So there is a discrepancy here which can lead to invalid and incompatible states matched due to lack of precision marking on r5. If r1 wasn't precise, precision backtracking would correctly mark both r1 and r5 as precise.
This is simple to fix, though. During the forward instruction simulation pass, for arithmetic operations of scalar <op>= scalar form (where <op> is ALU or ALU64 operations), if destination register is already precise, mark source register as precise. This applies only when both involved registers are SCALARs. ptr += scalar and scalar += ptr cases are already handled correctly.
This does have (negative) effect on some selftest programs and few Cilium programs. ~/baseline-tmp-results.csv are veristat results with this patch, while ~/baseline-results.csv is without it. See post scriptum for instructions on how to make Cilium programs testable with veristat. Correctness has a price.
$ ./veristat -C -e file,prog,insns,states ~/baseline-results.csv ~/baseline-tmp-results.csv | grep -v '+0' File Program Total insns (A) Total insns (B) Total insns (DIFF) Total states (A) Total states (B) Total states (DIFF) ----------------------- -------------------- --------------- --------------- ------------------ ---------------- ---------------- ------------------- bpf_cubic.bpf.linked1.o bpf_cubic_cong_avoid 997 1700 +703 (+70.51%) 62 90 +28 (+45.16%) test_l4lb.bpf.linked1.o balancer_ingress 4559 5469 +910 (+19.96%) 118 126 +8 (+6.78%) ----------------------- -------------------- --------------- --------------- ------------------ ---------------- ---------------- -------------------
$ ./veristat -C -e file,prog,verdict,insns,states ~/baseline-results-cilium.csv ~/baseline-tmp-results-cilium.csv | grep -v '+0' File Program Total insns (A) Total insns (B) Total insns (DIFF) Total states (A) Total states (B) Total states (DIFF) ------------- ------------------------------ --------------- --------------- ------------------ ---------------- ---------------- ------------------- bpf_host.o tail_nodeport_nat_ingress_ipv6 4448 5261 +813 (+18.28%) 234 247 +13 (+5.56%) bpf_host.o tail_nodeport_nat_ipv6_egress 3396 3446 +50 (+1.47%) 201 203 +2 (+1.00%) bpf_lxc.o tail_nodeport_nat_ingress_ipv6 4448 5261 +813 (+18.28%) 234 247 +13 (+5.56%) bpf_overlay.o tail_nodeport_nat_ingress_ipv6 4448 5261 +813 (+18.28%) 234 247 +13 (+5.56%) bpf_xdp.o tail_lb_ipv4 71736 73442 +1706 (+2.38%) 4295 4370 +75 (+1.75%) ------------- ------------------------------ --------------- --------------- ------------------ ---------------- ---------------- -------------------
P.S. To make Cilium ([0]) programs libbpf-compatible and thus veristat-loadable, apply changes from topmost commit in [1], which does minimal changes to Cilium source code, mostly around SEC() annotations and BPF map definitions.
[0] https://github.com/cilium/cilium/
[1] https://github.com/anakryiko/cilium/commits/libbpf-friendliness
--- kernel/bpf/verifier.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/bpf/verifier.c +5 -0
@@ -9215,6 +9215,11 @@ static int adjust_reg_min_max_vals(struct bpf_verifier_env *env,return err;return adjust_ptr_min_max_vals (env, insn, dst_reg, src_reg); + }else if (dst_reg->precise) { +/* if dst_reg is precise, src_reg should be precise as well */ + err =mark_chain_precision (env, insn->src_reg); +if (err) +return err; } }else {/* Pretend the src is a reg with a known value, since we only
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 294/1146 bpf: propagate precision across all frames, not just the last one
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 529409ea92d590659be487ba0839710329bd8074 ]
When equivalent completed state is found and it has additional precision restrictions, BPF verifier propagates precision to currently-being-verified state chain (i.e., including parent states) so that if some of the states in the chain are not yet completed, necessary precision restrictions are enforced.
Unfortunately, right now this happens only for the last frame (deepest active subprogram's frame), not all the frames. This can lead to incorrect matching of states due to missing precision marker. Currently this doesn't seem possible as BPF verifier forces everything to precise when validated BPF program has any subprograms. But with the next patch lifting this restriction, this becomes problematic.
In fact, without this fix, we'll start getting failure in one of the existing test_verifier test cases:
#906/p precise: cross frame pruning FAIL
Unexpected success to load!
verification time 48 usec
stack depth 0+0
processed 26 insns (limit 1000000) max_states_per_insn 3 total_states 17 peak_states 17 mark_read 8
This patch adds precision propagation across all frames.
--- kernel/bpf/verifier.c | 71 ++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 32 deletions(-)
kernel/bpf/verifier.c +39 -32
@@ -2768,7 +2768,7 @@ static void mark_all_scalars_precise(struct bpf_verifier_env *env, } } -static int __mark_chain_precision (struct bpf_verifier_env *env,int regno, +static int __mark_chain_precision (struct bpf_verifier_env *env,int frame,int regno,int spi) {struct bpf_verifier_state *st = env->cur_state;
@@ -2785,7 +2785,7 @@ static int __mark_chain_precision(struct bpf_verifier_env *env, int regno,if (!env->bpf_capable)return 0 ; - func = st->frame[st->curframe]; + func = st->frame[frame];if (regno >=0 ) { reg = &func->regs[regno];if (reg->type !=SCALAR_VALUE ) {
@@ -2866,7 +2866,7 @@ static int __mark_chain_precision(struct bpf_verifier_env *env, int regno,break ; new_marks = false; - func = st->frame[st->curframe]; + func = st->frame[frame];bitmap_from_u64 (mask, reg_mask);for_each_set_bit (i, mask,32 ) { reg = &func->regs[i];
@@ -2932,12 +2932,17 @@ static int __mark_chain_precision(struct bpf_verifier_env *env, int regno,int mark_chain_precision (struct bpf_verifier_env *env,int regno) { -return __mark_chain_precision (env, regno,-1 ); +return __mark_chain_precision (env, env->cur_state->curframe, regno,-1 ); } -static int mark_chain_precision_stack (struct bpf_verifier_env *env,int spi) +static int mark_chain_precision_frame (struct bpf_verifier_env *env,int frame,int regno) { -return __mark_chain_precision (env,-1 , spi); +return __mark_chain_precision (env, frame, regno,-1 ); +} + +static int mark_chain_precision_stack_frame (struct bpf_verifier_env *env,int frame,int spi) +{ +return __mark_chain_precision (env, frame,-1 , spi); }static bool is_spillable_regtype (enum bpf_reg_type type)
@@ -11856,34 +11861,36 @@ static int propagate_precision(struct bpf_verifier_env *env, {struct bpf_reg_state *state_reg;struct bpf_func_state *state; -int i, err =0 ; +int i, err =0 , fr; - state = old->frame[old->curframe]; - state_reg = state->regs; -for (i =0 ; i <BPF_REG_FP ; i++, state_reg++) { -if (state_reg->type !=SCALAR_VALUE || - !state_reg->precise) -continue ; -if (env->log.level &BPF_LOG_LEVEL2 ) -verbose (env,"propagating r%d\n" , i); - err =mark_chain_precision (env, i); -if (err <0 ) -return err; - } +for (fr = old->curframe; fr >=0 ; fr--) { + state = old->frame[fr]; + state_reg = state->regs; +for (i =0 ; i <BPF_REG_FP ; i++, state_reg++) { +if (state_reg->type !=SCALAR_VALUE || + !state_reg->precise) +continue ; +if (env->log.level &BPF_LOG_LEVEL2 ) +verbose (env,"frame %d: propagating r%d\n" , i, fr); + err =mark_chain_precision_frame (env, fr, i); +if (err <0 ) +return err; + } -for (i =0 ; i < state->allocated_stack /BPF_REG_SIZE ; i++) { -if (!is_spilled_reg (&state->stack[i])) -continue ; - state_reg = &state->stack[i].spilled_ptr; -if (state_reg->type !=SCALAR_VALUE || - !state_reg->precise) -continue ; -if (env->log.level &BPF_LOG_LEVEL2 ) -verbose (env,"propagating fp%d\n" , - (-i -1 ) *BPF_REG_SIZE ); - err =mark_chain_precision_stack (env, i); -if (err <0 ) -return err; +for (i =0 ; i < state->allocated_stack /BPF_REG_SIZE ; i++) { +if (!is_spilled_reg (&state->stack[i])) +continue ; + state_reg = &state->stack[i].spilled_ptr; +if (state_reg->type !=SCALAR_VALUE || + !state_reg->precise) +continue ; +if (env->log.level &BPF_LOG_LEVEL2 ) +verbose (env,"frame %d: propagating fp%d\n" , + (-i -1 ) *BPF_REG_SIZE , fr); + err =mark_chain_precision_stack_frame (env, fr, i); +if (err <0 ) +return err; + } }return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 295/1146 clk: qcom: gcc-ipq806x: use parent_data for the last remaining entry
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 55307e522cc7a4dddc3d231ca5cb7e68e9668f66 ]
Use parent_data for the last remaining entry (pll4). This clock is provided by the lcc device.
--- drivers/clk/qcom/gcc-ipq806x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq806x.c +3 -1
@@ -79,7 +79,9 @@ static struct clk_regmap pll4_vote = { .enable_mask = BIT(4), .hw.init = &(struct clk_init_data ){ .name ="pll4_vote" , - .parent_names = (const char *[]){"pll4" }, + .parent_data = &(const struct clk_parent_data ){ + .fw_name ="pll4" , .name ="pll4" , + }, .num_parents =1 , .ops = &clk_pll_vote_ops, },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 296/1146 clk: qcom: dispcc-sm6350: Add CLK_OPS_PARENT_ENABLE to pixel&byte src
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 92039e8c080c63748f8e133e7cfad33a75daefb6 ]
Add the CLK_OPS_PARENT_ENABLE flag to pixel and byte clk srcs to ensure set_rate can succeed.
--- drivers/clk/qcom/dispcc-sm6350.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/dispcc-sm6350.c +2 -2
@@ -306,7 +306,7 @@ static struct clk_rcg2 disp_cc_mdss_pclk0_clk_src = { .name = "disp_cc_mdss_pclk0_clk_src", .parent_data = disp_cc_parent_data_5, .num_parents = ARRAY_SIZE(disp_cc_parent_data_5), - .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE, + .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE | CLK_OPS_PARENT_ENABLE, .ops = &clk_pixel_ops, }, };
@@ -385,7 +385,7 @@ static struct clk_branch disp_cc_mdss_byte0_clk = { &disp_cc_mdss_byte0_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE, + .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE | CLK_OPS_PARENT_ENABLE, .ops = &clk_branch2_ops, }, },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 297/1146 clk: qcom: gcc-sm8250: Use retention mode for USB GDSCs
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit ac1c5a03d3772b1db25e8092f771aa33f6ae2f7e ]
USB controllers on SM8250 doesn't work after coming back from suspend. This can be fixed by keeping the USB GDSCs in retention mode so that hardware can keep them ON and put into rentention mode once the parent domain goes to a low power state.
--- drivers/clk/qcom/gcc-sm8250.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/gcc-sm8250.c +2 -2
@@ -3267,7 +3267,7 @@ static struct gdsc usb30_prim_gdsc = { .pd = { .name = "usb30_prim_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, };static struct gdsc usb30_sec_gdsc = {
@@ -3275,7 +3275,7 @@ static struct gdsc usb30_sec_gdsc = { .pd = { .name = "usb30_sec_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, };static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 298/1146 mtd: Fix device name leak when register device failed in add_mtd_device()
In reply to Greg Kroah-HartmanFrom: Zhang Xiaoxu <[email protected]>
[ Upstream commit 895d68a39481a75c680aa421546931fb11942fa6 ]
There is a kmemleak when register device failed:
unreferenced object 0xffff888101aab550 (size 8):
comm "insmod", pid 3922, jiffies 4295277753 (age 925.408s)
hex dump (first 8 bytes):
6d 74 64 30 00 88 ff ff mtd0....
backtrace:
[<00000000bde26724>] __kmalloc_node_track_caller+0x4e/0x150
[<000000003c32b416>] kvasprintf+0xb0/0x130
[<000000001f7a8f15>] kobject_set_name_vargs+0x2f/0xb0
[<000000006e781163>] dev_set_name+0xab/0xe0
[<00000000e30d0c78>] add_mtd_device+0x4bb/0x700
[<00000000f3d34de7>] mtd_device_parse_register+0x2ac/0x3f0
[<00000000c0d88488>] 0xffffffffa0238457
[<00000000b40d0922>] 0xffffffffa02a008f
[<0000000023d17b9d>] do_one_initcall+0x87/0x2a0
[<00000000770f6ca6>] do_init_module+0xdf/0x320
[<000000007b6768fe>] load_module+0x2f98/0x3330
[<00000000346bed5a>] __do_sys_finit_module+0x113/0x1b0
[<00000000674c2290>] do_syscall_64+0x35/0x80
[<000000004c6a8d97>] entry_SYSCALL_64_after_hwframe+0x46/0xb0If register device failed, should call put_device() to give up the reference.
--- drivers/mtd/mtdcore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/mtdcore.c +3 -1
@@ -723,8 +723,10 @@ int add_mtd_device(struct mtd_info *mtd)mtd_check_of_node (mtd);of_node_get (mtd_get_of_node (mtd)); error =device_register (&mtd->dev); -if (error) +if (error) { +put_device (&mtd->dev); goto fail_added; + }/* Add the nvmem provider */ error =mtd_nvmem_add (mtd);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 299/1146 mtd: core: fix possible resource leak in init_mtd()
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
[ Upstream commit 1aadf01e5076b9ab6bf294b9622335c651314895 ]
I got the error report while inject fault in init_mtd():
sysfs: cannot create duplicate filename '/devices/virtual/bdi/mtd-0'
Call Trace: <TASK> dump_stack_lvl+0x67/0x83 sysfs_warn_dup+0x60/0x70 sysfs_create_dir_ns+0x109/0x120 kobject_add_internal+0xce/0x2f0 kobject_add+0x98/0x110 device_add+0x179/0xc00 device_create_groups_vargs+0xf4/0x100 device_create+0x7b/0xb0 bdi_register_va.part.13+0x58/0x2d0 bdi_register+0x9b/0xb0 init_mtd+0x62/0x171 [mtd] do_one_initcall+0x6c/0x3c0 do_init_module+0x58/0x222 load_module+0x268e/0x27d0 __do_sys_finit_module+0xd5/0x140 do_syscall_64+0x37/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd </TASK>
kobject_add_internal failed for mtd-0 with -EEXIST, don't try to register
things with the same name in the same directory.
Error registering mtd class or bdi: -17
If init_mtdchar() fails in init_mtd(), mtd_bdi will not be unregistered, as a result, we can't load the mtd module again, to fix this by calling bdi_unregister(mtd_bdi) after out_procfs label.
--- drivers/mtd/mtdcore.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/mtdcore.c +1 -0
@@ -2485,6 +2485,7 @@ static int __init init_mtd(void) out_procfs:if (proc_mtd)remove_proc_entry ("mtd" ,NULL ); +bdi_unregister (mtd_bdi);bdi_put (mtd_bdi); err_bdi:class_unregister (&mtd_class);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 300/1146 Input: joystick - fix Kconfig warning for JOYSTICK_ADC
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 6100a19c4fcfe154dd32f8a8ef4e8c0b1f607c75 ]
Fix a Kconfig warning for JOYSTICK_ADC by also selecting IIO_BUFFER.
WARNING: unmet direct dependencies detected for IIO_BUFFER_CB
Depends on [n]: IIO [=y] && IIO_BUFFER [=n]
Selected by [y]:
- JOYSTICK_ADC [=y] && INPUT [=y] && INPUT_JOYSTICK [=y] && IIO [=y]
--- drivers/input/joystick/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/input/joystick/Kconfig +1 -0
@@ -46,6 +46,7 @@ config JOYSTICK_A3D config JOYSTICK_ADC tristate "Simple joystick connected over ADC" depends on IIO + select IIO_BUFFER select IIO_BUFFER_CB help Say Y here if you have a simple joystick connected over ADC.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 301/1146 wifi: rsi: Fix handling of 802.3 EAPOL frames sent via control port
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit b8f6efccbb9dc0ff5dee7e20d69a4747298ee603 ]
When using wpa_supplicant v2.10, this driver is no longer able to associate with any AP and fails in the EAPOL 4-way handshake while sending the 2/4 message to the AP. The problem is not present in wpa_supplicant v2.9 or older. The problem stems from HostAP commit 144314eaa ("wpa_supplicant: Send EAPOL frames over nl80211 where available") which changes the way EAPOL frames are sent, from them being send at L2 frames to them being sent via nl80211 control port.
An EAPOL frame sent as L2 frame is passed to the WiFi driver with skb->protocol ETH_P_PAE, while EAPOL frame sent via nl80211 control port has skb->protocol set to ETH_P_802_3 . The later happens in ieee80211_tx_control_port(), where the EAPOL frame is encapsulated into 802.3 frame.
The rsi_91x driver handles ETH_P_PAE EAPOL frames as high-priority frames and sends them via highest-priority transmit queue, while the ETH_P_802_3 frames are sent as regular frames. The EAPOL 4-way handshake frames must be sent as highest-priority, otherwise the 4-way handshake times out.
Therefore, to fix this problem, inspect the skb control flags and if flag IEEE80211_TX_CTRL_PORT_CTRL_PROTO is set, assume this is an EAPOL frame and transmit the frame via high-priority queue just like other ETH_P_PAE frames.
--- drivers/net/wireless/rsi/rsi_91x_core.c | 4 +++- drivers/net/wireless/rsi/rsi_91x_hal.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/rsi/rsi_91x_core.c +3 -1
@@ -466,7 +466,9 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb) tid, 0); } } -if (skb->protocol ==cpu_to_be16 (ETH_P_PAE )) { + +if (IEEE80211_SKB_CB (skb)->control.flags & +IEEE80211_TX_CTRL_PORT_CTRL_PROTO ) { q_num =MGMT_SOFT_Q ; skb->priority = q_num; }
drivers/net/wireless/rsi/rsi_91x_hal.c +5 -1
@@ -162,12 +162,16 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)u8 header_size;u8 vap_id =0 ;u8 dword_align_bytes; +bool tx_eapol;u16 seq_num; info =IEEE80211_SKB_CB (skb); vif = info->control.vif; tx_params = (struct skb_info *)info->driver_data; + tx_eapol =IEEE80211_SKB_CB (skb)->control.flags & +IEEE80211_TX_CTRL_PORT_CTRL_PROTO ; + header_size =FRAME_DESC_SZ +sizeof (struct rsi_xtended_desc );if (header_size >skb_headroom (skb)) {rsi_dbg (ERR_ZONE ,"%s: Unable to send pkt\n" , __func__);
@@ -231,7 +235,7 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb) } } -if (skb->protocol ==cpu_to_be16 (ETH_P_PAE )) { +if (tx_eapol) {rsi_dbg (INFO_ZONE ,"*** Tx EAPOL ***\n" ); data_desc->frame_info =cpu_to_le16 (RATE_INFO_ENABLE );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 302/1146 media: camss: Clean up received buffers on failed start of streaming
In reply to Greg Kroah-HartmanFrom: Vladimir Zapolskiy <[email protected]>
[ Upstream commit c8f3582345e6a69da65ab588f7c4c2d1685b0e80 ]
It is required to return the received buffers, if streaming can not be started. For instance media_pipeline_start() may fail with EPIPE, if a link validation between entities is not passed, and in such a case a user gets a kernel warning:
WARNING: CPU: 1 PID: 520 at drivers/media/common/videobuf2/videobuf2-core.c:1592 vb2_start_streaming+0xec/0x160 <snip> Call trace: vb2_start_streaming+0xec/0x160 vb2_core_streamon+0x9c/0x1a0 vb2_ioctl_streamon+0x68/0xbc v4l_streamon+0x30/0x3c __video_do_ioctl+0x184/0x3e0 video_usercopy+0x37c/0x7b0 video_ioctl2+0x24/0x40 v4l2_ioctl+0x4c/0x70
The fix is to correct the error path in video_start_streaming() of camss.
--- drivers/media/platform/qcom/camss/camss-video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/camss/camss-video.c +2 -1
@@ -495,7 +495,7 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count) ret =video_device_pipeline_start (vdev, &video->pipe);if (ret <0 ) -return ret; + goto flush_buffers; ret =video_check_format (video);if (ret <0 )
@@ -524,6 +524,7 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count) error:video_device_pipeline_stop (vdev); +flush_buffers: video->ops->flush_buffers (video,VB2_BUF_STATE_QUEUED );return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 303/1146 media: camss: Do not attach an already attached power domain on MSM8916 platform
In reply to Greg Kroah-HartmanFrom: Vladimir Zapolskiy <[email protected]>
[ Upstream commit 3d658980e6dac2af6a024fdb6ded3d7bc44dc9ff ]
The change to dynamically allocated power domains neglected a case of CAMSS on MSM8916 platform, where a single VFE power domain is neither attached, linked or managed in runtime in any way explicitly.
This is a special case and it shall be kept as is, because the power domain management is done outside of the driver, and it's very different in comparison to all other platforms supported by CAMSS.
--- drivers/media/platform/qcom/camss/camss.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/media/platform/qcom/camss/camss.c +11 -0
@@ -1465,6 +1465,14 @@ static int camss_configure_pd(struct camss *camss)return camss->genpd_num; } +/* +* If a platform device has just one power domain, then it is attached +* at platform_probe() level, thus there shall be no need and even no +* option to attach it again, this is the case for CAMSS on MSM8916. +*/ +if (camss->genpd_num ==1 ) +return 0 ; + camss->genpd =devm_kmalloc_array (dev, camss->genpd_num,sizeof (*camss->genpd),GFP_KERNEL );if (!camss->genpd)
@@ -1698,6 +1706,9 @@ void camss_delete(struct camss *camss)pm_runtime_disable (camss->dev); +if (camss->genpd_num ==1 ) +return ; +for (i =0 ; i < camss->genpd_num; i++) {device_link_del (camss->genpd_link[i]);dev_pm_domain_detach (camss->genpd[i], true);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 304/1146 clk: renesas: r8a779f0: Fix HSCIF parent clocks
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit c258e3ab639112d8f5ae9df9a873750ae2623ce2 ]
As serial communication requires a clean clock signal, the High Speed Serial Communication Interfaces with FIFO (HSCIF) are clocked by a clock that is not affected by Spread Spectrum or Fractional Multiplication.
Hence change the parent clocks for the HSCIF modules from the S0D3_PER clock to the SASYNCPERD1 clock (which has the same clock rate), cfr. R-Car S4-8 Hardware User's Manual rev. 0.81.
--- drivers/clk/renesas/r8a779f0-cpg-mssr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/renesas/r8a779f0-cpg-mssr.c +4 -4
@@ -126,10 +126,10 @@ static const struct cpg_core_clk r8a779f0_core_clks[] __initconst = { };static const struct mssr_mod_clk r8a779f0_mod_clks[]__initconst = { -DEF_MOD ("hscif0" ,514 ,R8A779F0_CLK_S0D3 ), -DEF_MOD ("hscif1" ,515 ,R8A779F0_CLK_S0D3 ), -DEF_MOD ("hscif2" ,516 ,R8A779F0_CLK_S0D3 ), -DEF_MOD ("hscif3" ,517 ,R8A779F0_CLK_S0D3 ), +DEF_MOD ("hscif0" ,514 ,R8A779F0_CLK_SASYNCPERD1 ), +DEF_MOD ("hscif1" ,515 ,R8A779F0_CLK_SASYNCPERD1 ), +DEF_MOD ("hscif2" ,516 ,R8A779F0_CLK_SASYNCPERD1 ), +DEF_MOD ("hscif3" ,517 ,R8A779F0_CLK_SASYNCPERD1 ),DEF_MOD ("i2c0" ,518 ,R8A779F0_CLK_S0D6_PER ),DEF_MOD ("i2c1" ,519 ,R8A779F0_CLK_S0D6_PER ),DEF_MOD ("i2c2" ,520 ,R8A779F0_CLK_S0D6_PER ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 305/1146 clk: renesas: r8a779f0: Fix SCIF parent clocks
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 2e0d7d3eabce3babae1fd66d7650e00c848a3b45 ]
As serial communication requires a clean clock signal, the Serial Communication Interfaces with FIFO (SCIF) are clocked by a clock that is not affected by Spread Spectrum or Fractional Multiplication.
Hence change the parent clocks for the SCIF modules from the S0D12_PER clock to the SASYNCPERD4 clock (which has the same clock rate), cfr. R-Car S4-8 Hardware User's Manual rev. 0.81.
--- drivers/clk/renesas/r8a779f0-cpg-mssr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/renesas/r8a779f0-cpg-mssr.c +4 -4
@@ -142,10 +142,10 @@ static const struct mssr_mod_clk r8a779f0_mod_clks[] __initconst = {DEF_MOD ("msiof3" ,621 ,R8A779F0_CLK_MSO ),DEF_MOD ("pcie0" ,624 ,R8A779F0_CLK_S0D2 ),DEF_MOD ("pcie1" ,625 ,R8A779F0_CLK_S0D2 ), -DEF_MOD ("scif0" ,702 ,R8A779F0_CLK_S0D12_PER ), -DEF_MOD ("scif1" ,703 ,R8A779F0_CLK_S0D12_PER ), -DEF_MOD ("scif3" ,704 ,R8A779F0_CLK_S0D12_PER ), -DEF_MOD ("scif4" ,705 ,R8A779F0_CLK_S0D12_PER ), +DEF_MOD ("scif0" ,702 ,R8A779F0_CLK_SASYNCPERD4 ), +DEF_MOD ("scif1" ,703 ,R8A779F0_CLK_SASYNCPERD4 ), +DEF_MOD ("scif3" ,704 ,R8A779F0_CLK_SASYNCPERD4 ), +DEF_MOD ("scif4" ,705 ,R8A779F0_CLK_SASYNCPERD4 ),DEF_MOD ("sdhi0" ,706 ,R8A779F0_CLK_SD0 ),DEF_MOD ("sys-dmac0" ,709 ,R8A779F0_CLK_S0D3_PER ), DEF_MOD("sys-dmac1", 710, R8A779F0_CLK_S0D3_PER),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 306/1146 virt/sev-guest: Add a MODULE_ALIAS
In reply to Greg Kroah-HartmanFrom: Cole Robinson <[email protected]>
[ Upstream commit 2874529b3513bdc90299c90f40713602da685e35 ]
Autoload the driver when, for example, SNP init code creates the corresponding platform device.
[ bp: Rewrite commit message. ]
--- drivers/virt/coco/sev-guest/sev-guest.c | 1 + 1 file changed, 1 insertion(+)
drivers/virt/coco/sev-guest/sev-guest.c +1 -0
@@ -800,3 +800,4 @@ MODULE_AUTHOR("Brijesh Singh <[email protected]>");MODULE_LICENSE ("GPL" );MODULE_VERSION ("1.0.0" );MODULE_DESCRIPTION ("AMD SEV Guest Driver" ); +MODULE_ALIAS ("platform:sev-guest" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 307/1146 net, proc: Provide PROC_FS=n fallback for proc_create_net_single_write()
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit c3d96f690a790074b508fe183a41e36a00cd7ddd ]
Provide a CONFIG_PROC_FS=n fallback for proc_create_net_single_write().
Also provide a fallback for proc_create_net_data_write().
--- include/linux/proc_fs.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/proc_fs.h +2 -0
@@ -208,8 +208,10 @@ static inline void proc_remove(struct proc_dir_entry *de) {}static inline int remove_proc_subtree (const char *name,struct proc_dir_entry *parent) {return 0 ; }#define proc_create_net_data (name, mode, parent, ops, state_size, data) ({NULL;}) +#define proc_create_net_data_write (name, mode, parent, ops, write, state_size, data) ({NULL;})#define proc_create_net (name, mode, parent, state_size, ops) ({NULL;})#define proc_create_net_single (name, mode, parent, show, data) ({NULL;}) +#define proc_create_net_single_write (name, mode, parent, show, write, data) ({NULL;})static inline struct pid *tgid_pidfd_to_pid (const struct file *file) {
Signature · 1 line
2.35.1
Re: [PATCH 6.1 0307/1146] net, proc: Provide PROC_FS=n fallback for proc_create_net_single_write()
This series was applied to bpf/bpf.git (master) by Arnaldo Carvalho de Melo <[email protected]>:
Hello:
This series was applied to bpf/bpf.git (master)
by Arnaldo Carvalho de Melo <[email protected]>:
Quoted 9 lines · On Wed, 28 Dec 2022 15:30:46 +0100 you wrote:
From: David Howells <[email protected]>
[ Upstream commit
c3d96f690a790074b508fe183a41e36a00cd7ddd]Provide a
CONFIG_PROC_FS=nfallback forproc_create_net_single_write().Also provide a fallback for
proc_create_net_data_write().[...]
Here is the summary with links:
- [6.1,0307/1146] net, proc: Provide PROC_FS=n fallback for proc_create_net_single_write() (no matching commit)
- [6.1,0770/1146] perf trace: Return error if a system call doesnt exist
https://git.kernel.org/bpf/bpf/c/d4223e1776c3 - [6.1,0771/1146] perf trace: Use macro RAW_SYSCALL_ARGS_NUM to replace number https://git.kernel.org/bpf/bpf/c/eadcab4c7a66 - [6.1,0772/1146] perf trace: Handle failure when trace point folder is missed https://git.kernel.org/bpf/bpf/c/03e9a5d8eb55 - [6.1,0786/1146] perf off_cpu: Fix a typo in BTF tracepoint name, it should be btf_trace_sched_switch https://git.kernel.org/bpf/bpf/c/167b266bf66c
- [6.1,0975/1146] bnx2: Use kmalloc_size_roundup() to match ksize() usage (no matching commit)
- [6.1,0994/1146] igb: Do not free q_vector unless new one was allocated (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Greg Kroah-Hartman
maintainerPATCH 308/1146 rxrpc: Fix ack.bufferSize to be 0 when generating an ack
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 8889a711f9b4dcf4dd1330fa493081beebd118c9 ]
ack.bufferSize should be set to 0 when generating an ack.
--- net/rxrpc/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/output.c +1 -1
@@ -93,7 +93,7 @@ static size_t rxrpc_fill_out_ack(struct rxrpc_connection *conn, *_hard_ack = hard_ack; *_top = top; - pkt->ack.bufferSpace =htons (8 ); + pkt->ack.bufferSpace =htons (0 ); pkt->ack.maxSkew =htons (0 ); pkt->ack.firstPacket =htonl (hard_ack +1 ); pkt->ack.previousPacket =htonl (call->ackr_highest_seq);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 309/1146 drm: lcdif: Set and enable FIFO Panic threshold
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit e3cac8f7749f78dacdf19c00ed5862a1db52239f ]
In case the LCDIFv3 is used to drive a 4k panel via i.MX8MP HDMI bridge, the LCDIFv3 becomes susceptible to FIFO underflows, these lead to nasty flicker of the image on the panel, or image being shifted by half frame horizontally every second frame. The flicker can be easily triggered by running 3D application on top of weston compositor, like neverball or chromium. Surprisingly glmark2-es2-wayland or glmark2-es2-drm does not trigger this effect so easily.
Configure the FIFO Panic threshold register and enable the FIFO Panic mode, which internally boosts the NoC interconnect priority for LCDIFv3 transactions in case of possible underflow. This mitigates the flicker effect on 4k panels as well.
--- drivers/gpu/drm/mxsfb/lcdif_kms.c | 16 ++++++++++++++++ drivers/gpu/drm/mxsfb/lcdif_regs.h | 1 + 2 files changed, 17 insertions(+)
drivers/gpu/drm/mxsfb/lcdif_kms.c +16 -0
@@ -5,6 +5,7 @@* This code is based on drivers/gpu/drm/mxsfb/mxsfb* */ +#include <linux/bitfield.h> #include <linux/clk.h> #include <linux/io.h> #include <linux/iopoll.h>
@@ -166,6 +167,18 @@ static void lcdif_enable_controller(struct lcdif_drm_private *lcdif) {u32 reg; +/* Set FIFO Panic watermarks, low 1/3, high 2/3 . */ +writel (FIELD_PREP (PANIC0_THRES_LOW_MASK ,1 *PANIC0_THRES_MAX /3 ) | +FIELD_PREP (PANIC0_THRES_HIGH_MASK ,2 *PANIC0_THRES_MAX /3 ), + lcdif->base +LCDC_V8_PANIC0_THRES ); + +/* +* Enable FIFO Panic, this does not generate interrupt, but +* boosts NoC priority based on FIFO Panic watermarks. +*/ +writel (INT_ENABLE_D1_PLANE_PANIC_EN , + lcdif->base +LCDC_V8_INT_ENABLE_D1 ); + reg =readl (lcdif->base +LCDC_V8_DISP_PARA ); reg |=DISP_PARA_DISP_ON ;writel (reg, lcdif->base +LCDC_V8_DISP_PARA );
@@ -193,6 +206,9 @@ static void lcdif_disable_controller(struct lcdif_drm_private *lcdif) reg =readl (lcdif->base +LCDC_V8_DISP_PARA ); reg &= ~DISP_PARA_DISP_ON ;writel (reg, lcdif->base +LCDC_V8_DISP_PARA ); + +/* Disable FIFO Panic NoC priority booster. */ +writel (0 , lcdif->base +LCDC_V8_INT_ENABLE_D1 ); }static void lcdif_reset_block (struct lcdif_drm_private *lcdif)
drivers/gpu/drm/mxsfb/lcdif_regs.h +1 -0
@@ -252,6 +252,7 @@#define PANIC0_THRES_LOW_MASK GENMASK(24, 16)#define PANIC0_THRES_HIGH_MASK GENMASK(8, 0) +#define PANIC0_THRES_MAX 511#define LCDIF_MIN_XRES 120#define LCDIF_MIN_YRES 120
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 310/1146 wifi: rtw89: use u32_encode_bits() to fill MAC quota value
In reply to Greg Kroah-HartmanFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 525c06c81d75690a9b795cc62a758838c1a6b6fe ]
Coverity reported shift 16 bits could cause sign extension and might get an unexpected value. Since the input values are predefined and no this kind of case, original code is safe so far. But, still changing them to use u32_encode_bits() will be more clear and prevent mistakes in the future.
The original message of Coverity is:
Suspicious implicit sign extension: "max_cfg->cma0_dma" with type "u16" (16 bits, unsigned) is promoted in "max_cfg->cma0_dma << 16" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "max_cfg->cma0_dma << 16" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1."
Addresses-Coverity-ID: 1527095 ("Integer handling issues")
--- drivers/net/wireless/realtek/rtw89/mac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw89/mac.c +2 -4
@@ -1429,10 +1429,8 @@ static int dle_mix_cfg(struct rtw89_dev *rtwdev, const struct rtw89_dle_mem *cfg#define INVALID_QT_WCPU U16_MAX#define SET_QUOTA_VAL (_min_x, _max_x, _module, _idx) \ do { \ - val = ((_min_x) & \ - B_AX_ ## _module ## _MIN_SIZE_MASK) | \ - (((_max_x) << 16) & \ - B_AX_ ## _module ## _MAX_SIZE_MASK); \ + val = u32_encode_bits(_min_x, B_AX_ ## _module ## _MIN_SIZE_MASK) | \ + u32_encode_bits(_max_x, B_AX_ ## _module ## _MAX_SIZE_MASK); \ rtw89_write32(rtwdev, \ R_AX_ ## _module ## _QTA ## _idx ## _CFG, \ val); \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 311/1146 drm: rcar-du: Drop leftovers dependencies from Kconfig
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit 1760eb547276299ab0c6a6cd3d29469e54ade615 ]
Commit 841281fe52a7 ("drm: rcar-du: Drop LVDS device tree backward compatibility") has removed device tree overlay sources used for backward compatibility with old bindings, but forgot to remove related dependencies from Kconfig. Fix it.
--- drivers/gpu/drm/rcar-du/Kconfig | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/rcar-du/Kconfig +0 -2
@@ -41,8 +41,6 @@ config DRM_RCAR_LVDS depends on DRM_RCAR_USE_LVDS select DRM_KMS_HELPER select DRM_PANEL - select OF_FLATTREE - select OF_OVERLAY config DRM_RCAR_USE_MIPI_DSI bool "R-Car DU MIPI DSI Encoder Support"
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 312/1146 regmap-irq: Use the new num_config_regs property in regmap_add_irq_chip_fwnode
In reply to Greg Kroah-HartmanFrom: Yassine Oudjana <[email protected]>
[ Upstream commit 84498d1fb35de6ab71bdfdb6270a464fb4a0951b ]
Commit faa87ce9196d ("regmap-irq: Introduce config registers for irq types") added the num_config_regs, then commit 9edd4f5aee84 ("regmap-irq:
Deprecate type registers and virtual registers") suggested to replace num_type_reg with it. However, regmap_add_irq_chip_fwnode wasn't modified to use the new property. Later on, commit 255a03bb1bb3 ("ASoC: wcd9335:
Convert irq chip to config regs") removed the old num_type_reg property from the WCD9335 driver's struct regmap_irq_chip, causing a null pointer dereference in regmap_irq_set_type when it tried to index d->type_buf as it was never allocated in regmap_add_irq_chip_fwnode:
[ 39.199374] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[ 39.200006] Call trace: [ 39.200014] regmap_irq_set_type+0x84/0x1c0 [ 39.200026] __irq_set_trigger+0x60/0x1c0 [ 39.200040] __setup_irq+0x2f4/0x78c [ 39.200051] request_threaded_irq+0xe8/0x1a0
Use num_config_regs in regmap_add_irq_chip_fwnode instead of num_type_reg, and fall back to it if num_config_regs isn't defined to maintain backward compatibility.
--- drivers/base/regmap/regmap-irq.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap-irq.c +11 -4
@@ -722,6 +722,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,int i;int ret = -ENOMEM ;int num_type_reg; +int num_regs;u32 reg;if (chip->num_regs <=0 )
@@ -796,14 +797,20 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, goto err_alloc; } - num_type_reg = chip->type_in_mask ? chip->num_regs : chip->num_type_reg; -if (num_type_reg) { - d->type_buf_def =kcalloc (num_type_reg, +/* +* Use num_config_regs if defined, otherwise fall back to num_type_reg +* to maintain backward compatibility. +*/ + num_type_reg = chip->num_config_regs ? chip->num_config_regs + : chip->num_type_reg; + num_regs = chip->type_in_mask ? chip->num_regs : num_type_reg; +if (num_regs) { + d->type_buf_def =kcalloc (num_regs,sizeof (*d->type_buf_def),GFP_KERNEL );if (!d->type_buf_def) goto err_alloc; - d->type_buf =kcalloc (num_type_reg,sizeof (*d->type_buf), + d->type_buf =kcalloc (num_regs,sizeof (*d->type_buf),GFP_KERNEL );if (!d->type_buf) goto err_alloc;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 313/1146 drbd: use blk_queue_max_discard_sectors helper
In reply to Greg Kroah-HartmanFrom: Christoph Böhmwalder <[email protected]>
[ Upstream commit 258bea6388ac93f34561fd91064232d14e174bff ]
We currently only set q->limits.max_discard_sectors, but that is not enough. Another field, max_hw_discard_sectors, was introduced in commit 0034af036554 ("block: make /sys/block/<dev>/queue/discard_max_bytes writeable").
The difference is that max_discard_sectors can be changed from user space via sysfs, while max_hw_discard_sectors is the "hardware" upper limit.
So use this helper, which sets both.
This is also a fixup for commit 998e9cbcd615 ("drbd: cleanup decide_on_discard_support"): if discards are not supported, that does not necessarily mean we also want to disable write_zeroes.
--- drivers/block/drbd/drbd_nl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/block/drbd/drbd_nl.c +5 -5
@@ -1210,6 +1210,7 @@ static void decide_on_discard_support(struct drbd_device *device,struct drbd_connection *connection =first_peer_device (device)->connection;struct request_queue *q = device->rq_queue; +unsigned int max_discard_sectors;if (bdev && !bdev_max_discard_sectors (bdev->backing_bdev)) goto not_supported;
@@ -1230,15 +1231,14 @@ static void decide_on_discard_support(struct drbd_device *device,* topology on all peers. */ blk_queue_discard_granularity (q,512 ); - q->limits.max_discard_sectors =drbd_max_discard_sectors (connection); - q->limits.max_write_zeroes_sectors = -drbd_max_discard_sectors (connection); + max_discard_sectors =drbd_max_discard_sectors (connection); +blk_queue_max_discard_sectors (q, max_discard_sectors); +blk_queue_max_write_zeroes_sectors (q, max_discard_sectors);return ; not_supported:blk_queue_discard_granularity (q,0 ); - q->limits.max_discard_sectors =0 ; - q->limits.max_write_zeroes_sectors =0 ; +blk_queue_max_discard_sectors (q,0 ); }static void fixup_write_zeroes (struct drbd_device *device,struct request_queue *q)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 314/1146 bfq: fix waker_bfqq inconsistency crash
In reply to Greg Kroah-HartmanFrom: Khazhismel Kumykov <[email protected]>
[ Upstream commit a1795c2ccb1e4c49220d2a0d381540024d71647c ]
This fixes crashes in bfq_add_bfqq_busy due to waker_bfqq being NULL, but woken_list_node still being hashed. This would happen when bfq_init_rq() expects a brand new allocated queue to be returned from bfq_get_bfqq_handle_split() and unconditionally updates waker_bfqq without resetting woken_list_node. Since we can always return oom_bfqq when attempting to allocate, we cannot assume waker_bfqq starts as NULL.
Avoid setting woken_bfqq for oom_bfqq entirely, as it's not useful.
Crashes would have a stacktrace like:
[160595.656560] bfq_add_bfqq_busy+0x110/0x1ec [160595.661142] bfq_add_request+0x6bc/0x980 [160595.666602] bfq_insert_request+0x8ec/0x1240 [160595.671762] bfq_insert_requests+0x58/0x9c [160595.676420] blk_mq_sched_insert_request+0x11c/0x198 [160595.682107] blk_mq_submit_bio+0x270/0x62c [160595.686759] __submit_bio_noacct_mq+0xec/0x178 [160595.691926] submit_bio+0x120/0x184 [160595.695990] ext4_mpage_readpages+0x77c/0x7c8 [160595.701026] ext4_readpage+0x60/0xb0 [160595.705158] filemap_read_page+0x54/0x114 [160595.711961] filemap_fault+0x228/0x5f4 [160595.716272] do_read_fault+0xe0/0x1f0 [160595.720487] do_fault+0x40/0x1c8
Tested by injecting random failures into bfq_get_queue, crashes go away completely.
--- block/bfq-iosched.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
block/bfq-iosched.c +7 -2
@@ -6784,6 +6784,12 @@ static struct bfq_queue *bfq_init_rq(struct request *rq) bfqq =bfq_get_bfqq_handle_split (bfqd, bic, bio, true, is_sync,NULL ); +if (unlikely (bfqq == &bfqd->oom_bfqq)) + bfqq_already_existing = true; + }else + bfqq_already_existing = true; + +if (!bfqq_already_existing) { bfqq->waker_bfqq = old_bfqq->waker_bfqq; bfqq->tentative_waker_bfqq =NULL ;
@@ -6797,8 +6803,7 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)if (bfqq->waker_bfqq)hlist_add_head (&bfqq->woken_list_node, &bfqq->waker_bfqq->woken_list); - }else - bfqq_already_existing = true; + } } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 315/1146 drm/radeon: Add the missed acpi_put_table() to fix memory leak
In reply to Greg Kroah-HartmanFrom: Hanjun Guo <[email protected]>
[ Upstream commit 10276a20be1115e1f76c189330da2992df980eee ]
When the radeon driver reads the bios information from ACPI table in radeon_acpi_vfct_bios(), it misses to call acpi_put_table() to release the ACPI memory after the init, so add acpi_put_table() properly to fix the memory leak.
v2: fix text formatting (Alex)
--- drivers/gpu/drm/radeon/radeon_bios.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/radeon/radeon_bios.c +11 -7
@@ -612,13 +612,14 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)acpi_size tbl_size;UEFI_ACPI_VFCT *vfct;unsigned offset; +bool r = false;if (!ACPI_SUCCESS (acpi_get_table ("VFCT" ,1 , &hdr)))return false; tbl_size = hdr->length;if (tbl_size <sizeof (UEFI_ACPI_VFCT )) {DRM_ERROR ("ACPI VFCT table present but broken (too short #1)\n" ); -return false; + goto out; } vfct = (UEFI_ACPI_VFCT *)hdr;
@@ -631,13 +632,13 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev) offset +=sizeof (VFCT_IMAGE_HEADER );if (offset > tbl_size) {DRM_ERROR ("ACPI VFCT image header truncated\n" ); -return false; + goto out; } offset += vhdr->ImageLength;if (offset > tbl_size) {DRM_ERROR ("ACPI VFCT image truncated\n" ); -return false; + goto out; } if (vhdr->ImageLength &&
@@ -649,15 +650,18 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev) rdev->bios =kmemdup (&vbios->VbiosContent, vhdr->ImageLength,GFP_KERNEL ); +if (rdev->bios) + r = true; -if (!rdev->bios) -return false; - return true; + goto out; } }DRM_ERROR ("ACPI VFCT table present but broken (too short #2)\n" ); -return false; + +out: +acpi_put_table (hdr); +return r; }#else static inline bool radeon_acpi_vfct_bios (struct radeon_device *rdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 316/1146 dt-bindings: pinctrl: update uart/mmc bindings for MT7986 SoC
In reply to Greg Kroah-HartmanFrom: Frank Wunderlich <[email protected]>
[ Upstream commit c115e7f51e685536ecb885854bdd4b3f225ff3e4 ]
Fix mmc and uart pins after uart splitting.
Some pinmux pins of the mt7986 pinctrl driver is composed of multiple pinctrl groups, the original binding only allows one pinctrl group per dts node, this patch sets "maxItems" for these groups and add new examples to the binding documentation.
--- .../pinctrl/mediatek,mt7986-pinctrl.yaml | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/pinctrl/mediatek,mt7986-pinctrl.yaml +41 -5
@@ -87,6 +87,8 @@ patternProperties: "wifi_led" "led" 1, 2 "i2c" "i2c" 3, 4 "uart1_0" "uart" 7, 8, 9, 10 + "uart1_rx_tx" "uart" 42, 43 + "uart1_cts_rts" "uart" 44, 45 "pcie_clk" "pcie" 9 "pcie_wake" "pcie" 10 "spi1_0" "spi" 11, 12, 13, 14
@@ -98,9 +100,11 @@ patternProperties: "emmc_45" "emmc" 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 "spi1_1" "spi" 23, 24, 25, 26 - "uart1_2" "uart" 29, 30, 31, 32 + "uart1_2_rx_tx" "uart" 29, 30 + "uart1_2_cts_rts" "uart" 31, 32 "uart1_1" "uart" 23, 24, 25, 26 - "uart2_0" "uart" 29, 30, 31, 32 + "uart2_0_rx_tx" "uart" 29, 30 + "uart2_0_cts_rts" "uart" 31, 32 "spi0" "spi" 33, 34, 35, 36 "spi0_wp_hold" "spi" 37, 38 "uart1_3_rx_tx" "uart" 35, 36
@@ -157,7 +161,7 @@ patternProperties: then: properties: groups: - enum: [emmc, emmc_rst] + enum: [emmc_45, emmc_51] - if: properties: function:
@@ -221,8 +225,12 @@ patternProperties: then: properties: groups: - enum: [uart1_0, uart1_1, uart1_2, uart1_3_rx_tx, - uart1_3_cts_rts, uart2_0, uart2_1, uart0, uart1, uart2] + items: + enum: [uart1_0, uart1_rx_tx, uart1_cts_rts, uart1_1, + uart1_2_rx_tx, uart1_2_cts_rts, uart1_3_rx_tx, + uart1_3_cts_rts, uart2_0_rx_tx, uart2_0_cts_rts, + uart2_1, uart0, uart1, uart2] + maxItems: 2 - if: properties: function:
@@ -356,6 +364,27 @@ examples: interrupt-parent = <&gic>; #interrupt-cells = <2>; + pcie_pins: pcie-pins { + mux { + function = "pcie"; + groups = "pcie_clk", "pcie_wake", "pcie_pereset"; + }; + }; + + pwm_pins: pwm-pins { + mux { + function = "pwm"; + groups = "pwm0", "pwm1_0"; + }; + }; + + spi0_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; + uart1_pins: uart1-pins { mux { function = "uart";
@@ -363,6 +392,13 @@ examples: }; }; + uart1_3_pins: uart1-3-pins { + mux { + function = "uart"; + groups = "uart1_3_rx_tx", "uart1_3_cts_rts"; + }; + }; + uart2_pins: uart2-pins { mux { function = "uart";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 317/1146 pinctrl: mediatek: fix the pinconf register offset of some pins
In reply to Greg Kroah-HartmanFrom: Sam Shih <[email protected]>
[ Upstream commit 3476b354c65db442580ef355885c69e60c546ef0 ]
Correct the bias-pull-up, bias-pull-down and bias-disable register offset of mt7986 pin-42 to pin-49, in the original driver, the relative offset value was erroneously decremented by 1.
--- drivers/pinctrl/mediatek/pinctrl-mt7986.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/pinctrl/mediatek/pinctrl-mt7986.c +12 -12
@@ -316,10 +316,10 @@ static const struct mtk_pin_field_calc mt7986_pin_pupd_range[] = {PIN_FIELD_BASE (38 ,38 ,IOCFG_LT_BASE ,0x30 ,0x10 ,9 ,1 ),PIN_FIELD_BASE (39 ,40 ,IOCFG_RB_BASE ,0x60 ,0x10 ,18 ,1 ),PIN_FIELD_BASE (41 ,41 ,IOCFG_RB_BASE ,0x60 ,0x10 ,12 ,1 ), -PIN_FIELD_BASE (42 ,43 ,IOCFG_RB_BASE ,0x60 ,0x10 ,22 ,1 ), -PIN_FIELD_BASE (44 ,45 ,IOCFG_RB_BASE ,0x60 ,0x10 ,20 ,1 ), -PIN_FIELD_BASE (46 ,47 ,IOCFG_RB_BASE ,0x60 ,0x10 ,26 ,1 ), -PIN_FIELD_BASE (48 ,49 ,IOCFG_RB_BASE ,0x60 ,0x10 ,24 ,1 ), +PIN_FIELD_BASE (42 ,43 ,IOCFG_RB_BASE ,0x60 ,0x10 ,23 ,1 ), +PIN_FIELD_BASE (44 ,45 ,IOCFG_RB_BASE ,0x60 ,0x10 ,21 ,1 ), +PIN_FIELD_BASE (46 ,47 ,IOCFG_RB_BASE ,0x60 ,0x10 ,27 ,1 ), +PIN_FIELD_BASE (48 ,49 ,IOCFG_RB_BASE ,0x60 ,0x10 ,25 ,1 ),PIN_FIELD_BASE (50 ,57 ,IOCFG_RT_BASE ,0x40 ,0x10 ,2 ,1 ),PIN_FIELD_BASE (58 ,58 ,IOCFG_RT_BASE ,0x40 ,0x10 ,1 ,1 ), PIN_FIELD_BASE(59, 59, IOCFG_RT_BASE, 0x40, 0x10, 0, 1),
@@ -354,10 +354,10 @@ static const struct mtk_pin_field_calc mt7986_pin_r0_range[] = {PIN_FIELD_BASE (38 ,38 ,IOCFG_LT_BASE ,0x40 ,0x10 ,9 ,1 ),PIN_FIELD_BASE (39 ,40 ,IOCFG_RB_BASE ,0x70 ,0x10 ,18 ,1 ),PIN_FIELD_BASE (41 ,41 ,IOCFG_RB_BASE ,0x70 ,0x10 ,12 ,1 ), -PIN_FIELD_BASE (42 ,43 ,IOCFG_RB_BASE ,0x70 ,0x10 ,22 ,1 ), -PIN_FIELD_BASE (44 ,45 ,IOCFG_RB_BASE ,0x70 ,0x10 ,20 ,1 ), -PIN_FIELD_BASE (46 ,47 ,IOCFG_RB_BASE ,0x70 ,0x10 ,26 ,1 ), -PIN_FIELD_BASE (48 ,49 ,IOCFG_RB_BASE ,0x70 ,0x10 ,24 ,1 ), +PIN_FIELD_BASE (42 ,43 ,IOCFG_RB_BASE ,0x70 ,0x10 ,23 ,1 ), +PIN_FIELD_BASE (44 ,45 ,IOCFG_RB_BASE ,0x70 ,0x10 ,21 ,1 ), +PIN_FIELD_BASE (46 ,47 ,IOCFG_RB_BASE ,0x70 ,0x10 ,27 ,1 ), +PIN_FIELD_BASE (48 ,49 ,IOCFG_RB_BASE ,0x70 ,0x10 ,25 ,1 ),PIN_FIELD_BASE (50 ,57 ,IOCFG_RT_BASE ,0x50 ,0x10 ,2 ,1 ),PIN_FIELD_BASE (58 ,58 ,IOCFG_RT_BASE ,0x50 ,0x10 ,1 ,1 ), PIN_FIELD_BASE(59, 59, IOCFG_RT_BASE, 0x50, 0x10, 0, 1),
@@ -392,10 +392,10 @@ static const struct mtk_pin_field_calc mt7986_pin_r1_range[] = {PIN_FIELD_BASE (38 ,38 ,IOCFG_LT_BASE ,0x50 ,0x10 ,9 ,1 ),PIN_FIELD_BASE (39 ,40 ,IOCFG_RB_BASE ,0x80 ,0x10 ,18 ,1 ),PIN_FIELD_BASE (41 ,41 ,IOCFG_RB_BASE ,0x80 ,0x10 ,12 ,1 ), -PIN_FIELD_BASE (42 ,43 ,IOCFG_RB_BASE ,0x80 ,0x10 ,22 ,1 ), -PIN_FIELD_BASE (44 ,45 ,IOCFG_RB_BASE ,0x80 ,0x10 ,20 ,1 ), -PIN_FIELD_BASE (46 ,47 ,IOCFG_RB_BASE ,0x80 ,0x10 ,26 ,1 ), -PIN_FIELD_BASE (48 ,49 ,IOCFG_RB_BASE ,0x80 ,0x10 ,24 ,1 ), +PIN_FIELD_BASE (42 ,43 ,IOCFG_RB_BASE ,0x80 ,0x10 ,23 ,1 ), +PIN_FIELD_BASE (44 ,45 ,IOCFG_RB_BASE ,0x80 ,0x10 ,21 ,1 ), +PIN_FIELD_BASE (46 ,47 ,IOCFG_RB_BASE ,0x80 ,0x10 ,27 ,1 ), +PIN_FIELD_BASE (48 ,49 ,IOCFG_RB_BASE ,0x80 ,0x10 ,25 ,1 ),PIN_FIELD_BASE (50 ,57 ,IOCFG_RT_BASE ,0x60 ,0x10 ,2 ,1 ),PIN_FIELD_BASE (58 ,58 ,IOCFG_RT_BASE ,0x60 ,0x10 ,1 ,1 ), PIN_FIELD_BASE(59, 59, IOCFG_RT_BASE, 0x60, 0x10, 0, 1),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 318/1146 wifi: iwlwifi: mei: make sure ownership confirmed message is sent
In reply to Greg Kroah-HartmanFrom: Avraham Stern <[email protected]>
[ Upstream commit 5aa7ce31bd84c2f4f059200f06c537c920cbb458 ]
It is possible that CSME will try to take ownership while the driver is stopping. In this case, if the CSME takes ownership message arrives after the driver started unregistering, the iwl_mei_cache->ops is already invalid, so the host will not answer with the ownership confirmed message.
Similarly, if the take ownership message arrived after the mac was stopped or when iwl_mvm_up() failed, setting rfkill will not trigger sending the confirm message. As a result, CSME will not take ownership, which will result in a disconnection.
Fix it by sending the ownership confirmed message immediately in such cases.
--- .../net/wireless/intel/iwlwifi/mei/iwl-mei.h | 7 +++-- drivers/net/wireless/intel/iwlwifi/mei/main.c | 30 ++++++++++++------- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 2 ++ drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 4 +-- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 2 +- 5 files changed, 29 insertions(+), 16 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/iwl-mei.h +4 -3
@@ -446,9 +446,10 @@ void iwl_mei_host_associated(const struct iwl_mei_conn_info *conn_info,void iwl_mei_host_disassociated (void );/** -* iwl_mei_device_down() - must be called when the device is down +* iwl_mei_device_state() - must be called when the device changes up/down state +* @up: true if the device is up, false otherwise. */ -void iwl_mei_device_down (void ); +void iwl_mei_device_state (bool up);#else
@@ -497,7 +498,7 @@ static inline void iwl_mei_host_associated(const struct iwl_mei_conn_info *conn_static inline void iwl_mei_host_disassociated (void ) {} -static inline void iwl_mei_device_down (void ) +static inline void iwl_mei_device_state (bool up) {}#endif /* CONFIG_IWLMEI */
drivers/net/wireless/intel/iwlwifi/mei/main.c +20 -10
@@ -147,6 +147,8 @@ struct iwl_mei_filters {* to send CSME_OWNERSHIP_CONFIRMED when the driver completes its down * flow. * @link_prot_state: true when we are in link protection PASSIVE +* @device_down: true if the device is down. Used to remember to send +* CSME_OWNERSHIP_CONFIRMED when the driver is already down. * @csa_throttle_end_wk: used when &csa_throttled is true * @data_q_lock: protects the access to the data queues which are * accessed without the mutex.
@@ -167,6 +169,7 @@ struct iwl_mei {bool csa_throttled;bool csme_taking_ownership;bool link_prot_state; +bool device_down;struct delayed_work csa_throttle_end_wk;spinlock_t data_q_lock;
@@ -798,14 +801,18 @@ static void iwl_mei_handle_csme_taking_ownership(struct mei_cl_device *cldev, mei->got_ownership = false; -/* -* Remember to send CSME_OWNERSHIP_CONFIRMED when the wifi driver -* is finished taking the device down. -*/ - mei->csme_taking_ownership = true; +if (iwl_mei_cache.ops && !mei->device_down) { +/* +* Remember to send CSME_OWNERSHIP_CONFIRMED when the wifi +* driver is finished taking the device down. +*/ + mei->csme_taking_ownership = true; -if (iwl_mei_cache.ops) - iwl_mei_cache.ops->rfkill (iwl_mei_cache.priv, true); + iwl_mei_cache.ops->rfkill (iwl_mei_cache.priv, true, true); + }else { +iwl_mei_send_sap_msg (cldev, +SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED ); + } } static void iwl_mei_handle_nvm(struct mei_cl_device *cldev,
@@ -1616,7 +1623,7 @@ void iwl_mei_set_netdev(struct net_device *netdev) }EXPORT_SYMBOL_GPL (iwl_mei_set_netdev); -void iwl_mei_device_down (void ) +void iwl_mei_device_state (bool up) {struct iwl_mei *mei;
@@ -1630,7 +1637,9 @@ void iwl_mei_device_down(void)if (!mei) goto out; -if (!mei->csme_taking_ownership) + mei->device_down = !up; + +if (up || !mei->csme_taking_ownership) goto out; iwl_mei_send_sap_msg(mei->cldev,
@@ -1639,7 +1648,7 @@ void iwl_mei_device_down(void) out:mutex_unlock (&iwl_mei_mutex); } -EXPORT_SYMBOL_GPL (iwl_mei_device_down); +EXPORT_SYMBOL_GPL (iwl_mei_device_state);int iwl_mei_register (void *priv,const struct iwl_mei_ops *ops) {
@@ -1821,6 +1830,7 @@ static int iwl_mei_probe(struct mei_cl_device *cldev,mei_cldev_set_drvdata (cldev, mei); mei->cldev = cldev; + mei->device_down = true; do { ret = iwl_mei_alloc_shared_mem(cldev);
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +2 -0
@@ -1665,6 +1665,8 @@ int iwl_mvm_up(struct iwl_mvm *mvm)iwl_rfi_send_config_cmd (mvm,NULL ); } +iwl_mvm_mei_device_state (mvm, true); +IWL_DEBUG_INFO (mvm,"RT uCode started.\n" );return 0 ; error:
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +2 -2
@@ -2201,10 +2201,10 @@ static inline void iwl_mvm_mei_host_disassociated(struct iwl_mvm *mvm)iwl_mei_host_disassociated (); } -static inline void iwl_mvm_mei_device_down (struct iwl_mvm *mvm) +static inline void iwl_mvm_mei_device_state (struct iwl_mvm *mvm,bool up) {if (mvm->mei_registered) -iwl_mei_device_down (); +iwl_mei_device_state (up); }static inline void iwl_mvm_mei_set_sw_rfkill_state (struct iwl_mvm *mvm)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +1 -1
@@ -1375,7 +1375,7 @@ void iwl_mvm_stop_device(struct iwl_mvm *mvm)iwl_trans_stop_device (mvm->trans);iwl_free_fw_paging (&mvm->fwrt);iwl_fw_dump_conf_clear (&mvm->fwrt); -iwl_mvm_mei_device_down (mvm); +iwl_mvm_mei_device_state (mvm, false); }static void iwl_op_mode_mvm_stop (struct iwl_op_mode *op_mode)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 319/1146 wifi: iwlwifi: mei: dont send SAP commands if AMT is disabled
In reply to Greg Kroah-HartmanFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 95170a46b7dddbc3ac31b20ef2e8fa9d556d783d ]
We should not send any SAP command to CSME if AMT is disabled.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 85 ++++++++++--------- 1 file changed, 44 insertions(+), 41 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +44 -41
@@ -596,8 +596,6 @@ iwl_mei_handle_rx_start_ok(struct mei_cl_device *cldev, const struct iwl_sap_me_msg_start_ok *rsp, ssize_t len) { - struct iwl_mei *mei = mei_cldev_get_drvdata(cldev); - if (len != sizeof(*rsp)) { dev_err(&cldev->dev, "got invalid SAP_ME_MSG_START_OK from CSME firmware\n");
@@ -616,13 +614,10 @@ iwl_mei_handle_rx_start_ok(struct mei_cl_device *cldev,mutex_lock (&iwl_mei_mutex);set_bit (IWL_MEI_STATUS_SAP_CONNECTED , &iwl_mei_status); -/* wifi driver has registered already */ -if (iwl_mei_cache.ops) { -iwl_mei_send_sap_msg (mei->cldev, -SAP_MSG_NOTIF_WIFIDR_UP ); - iwl_mei_cache.ops->sap_connected (iwl_mei_cache.priv); - } - +/* +* We'll receive AMT_STATE SAP message in a bit and +* that will continue the flow +*/ mutex_unlock (&iwl_mei_mutex); }
@@ -715,6 +710,13 @@ static void iwl_mei_set_init_conf(struct iwl_mei *mei) .val = cpu_to_le32(iwl_mei_cache.rf_kill), }; +/* wifi driver has registered already */ +if (iwl_mei_cache.ops) { +iwl_mei_send_sap_msg (mei->cldev, +SAP_MSG_NOTIF_WIFIDR_UP ); + iwl_mei_cache.ops->sap_connected (iwl_mei_cache.priv); + } +iwl_mei_send_sap_msg (mei->cldev,SAP_MSG_NOTIF_WHO_OWNS_NIC );if (iwl_mei_cache.conn_info) {
@@ -1420,10 +1422,7 @@ void iwl_mei_host_associated(const struct iwl_mei_conn_info *conn_info, mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei) - goto out; - -if (!mei->amt_enabled) +if (!mei && !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1452,7 +1451,7 @@ void iwl_mei_host_disassociated(void) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei) +if (!mei && !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1488,7 +1487,7 @@ void iwl_mei_set_rfkill_state(bool hw_rfkill, bool sw_rfkill) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei) +if (!mei && !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1517,7 +1516,7 @@ void iwl_mei_set_nic_info(const u8 *mac_address, const u8 *nvm_address) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei) +if (!mei && !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1545,7 +1544,7 @@ void iwl_mei_set_country_code(u16 mcc) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei) +if (!mei && !mei->amt_enabled) goto out;iwl_mei_send_sap_msg_payload (mei->cldev, &msg.hdr);
@@ -1571,7 +1570,7 @@ void iwl_mei_set_power_limit(const __le16 *power_limit) mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); -if (!mei) +if (!mei && !mei->amt_enabled) goto out;memcpy (msg.sar_chain_info_table, power_limit,sizeof (msg.sar_chain_info_table));
@@ -1678,9 +1677,10 @@ int iwl_mei_register(void *priv, const struct iwl_mei_ops *ops)/* we have already a SAP connection */ if (iwl_mei_is_connected ()) { -iwl_mei_send_sap_msg (mei->cldev, -SAP_MSG_NOTIF_WIFIDR_UP ); - ops->rfkill (priv, mei->link_prot_state); +if (mei->amt_enabled) +iwl_mei_send_sap_msg (mei->cldev, +SAP_MSG_NOTIF_WIFIDR_UP ); + ops->rfkill (priv, mei->link_prot_state, false); } } ret =0 ;
@@ -1931,29 +1931,32 @@ static void iwl_mei_remove(struct mei_cl_device *cldev)mutex_lock (&iwl_mei_mutex); -/* -* Tell CSME that we are going down so that it won't access the -* memory anymore, make sure this message goes through immediately. -*/ - mei->csa_throttled = false; -iwl_mei_send_sap_msg (mei->cldev, -SAP_MSG_NOTIF_HOST_GOES_DOWN ); +if (mei->amt_enabled) { +/* +* Tell CSME that we are going down so that it won't access the +* memory anymore, make sure this message goes through immediately. +*/ + mei->csa_throttled = false; +iwl_mei_send_sap_msg (mei->cldev, +SAP_MSG_NOTIF_HOST_GOES_DOWN ); -for (i =0 ; i <SEND_SAP_MAX_WAIT_ITERATION ; i++) { -if (!iwl_mei_host_to_me_data_pending (mei)) -break ; +for (i =0 ; i <SEND_SAP_MAX_WAIT_ITERATION ; i++) { +if (!iwl_mei_host_to_me_data_pending (mei)) +break ; -msleep (5 ); - } +msleep (20 ); + } -/* -* If we couldn't make sure that CSME saw the HOST_GOES_DOWN message, -* it means that it will probably keep reading memory that we are going -* to unmap and free, expect IOMMU error messages. -*/ -if (i ==SEND_SAP_MAX_WAIT_ITERATION ) -dev_err (&mei->cldev->dev, -"Couldn't get ACK from CSME on HOST_GOES_DOWN message\n" ); +/* +* If we couldn't make sure that CSME saw the HOST_GOES_DOWN +* message, it means that it will probably keep reading memory +* that we are going to unmap and free, expect IOMMU error +* messages. +*/ +if (i ==SEND_SAP_MAX_WAIT_ITERATION ) +dev_err (&mei->cldev->dev, +"Couldn't get ACK from CSME on HOST_GOES_DOWN message\n" ); + }mutex_unlock (&iwl_mei_mutex);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 320/1146 wifi: iwlwifi: mei: fix tx DHCP packet for devices with new Tx API
In reply to Greg Kroah-HartmanFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit bcd68b3dbe78b7b0f7b6b55162cf1eff1e7fff9e ]
Devices with new Tx API have the IV introduced by the HW and it is not present in the skb at all. Hence we don't need to tell iwl_mvm_mei_tx_copy_to_csme to jump over 8 bytes to get to the ethernet header.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +7 -1
@@ -1171,9 +1171,15 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,/* From now on, we cannot access info->control */ iwl_mvm_skb_prepare_status (skb, dev_cmd); +/* +* The IV is introduced by the HW for new tx api, and it is not present +* in the skb, hence, don't tell iwl_mvm_mei_tx_copy_to_csme about the +* IV for those devices. +*/ if (ieee80211_is_data (fc))iwl_mvm_mei_tx_copy_to_csme (mvm, skb, - info->control.hw_key ? + info->control.hw_key && + !iwl_mvm_has_new_tx_api (mvm) ? info->control.hw_key->iv_len :0 );if (iwl_trans_tx (mvm->trans, skb, dev_cmd, txq_id))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 321/1146 wifi: iwlwifi: mei: avoid blocking sap messages handling due to rtnl lock
In reply to Greg Kroah-HartmanFrom: Avraham Stern <[email protected]>
[ Upstream commit d288067ede4b375e72daf7f9a98d937ede11a311 ]
The AMT_STATE sap message handler tries to take the rtnl lock. This means that in case the rtnl lock is already taken, sap messages will not be processed.
When an interface is brought up, the host requests ownership from csme. However, since the rtnl lock is already held, if there is a pending amt state message, the host will not be able to read the ownership confirm message because the amt state message handler is pending. As a result, the host fails to get ownership although csme granted it.
Fix it by moving the part that needs the rtnl lock into a dedicated worker, so handling sap messages can continue.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 57 ++++++++++++------- 1 file changed, 37 insertions(+), 20 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +37 -20
@@ -152,6 +152,8 @@ struct iwl_mei_filters {* @csa_throttle_end_wk: used when &csa_throttled is true * @data_q_lock: protects the access to the data queues which are * accessed without the mutex. +* @netdev_work: used to defer registering and unregistering of the netdev to +* avoid taking the rtnl lock in the SAP messages handlers. * @sap_seq_no: the sequence number for the SAP messages * @seq_no: the sequence number for the SAP messages * @dbgfs_dir: the debugfs dir entry
@@ -172,6 +174,7 @@ struct iwl_mei {bool device_down;struct delayed_work csa_throttle_end_wk;spinlock_t data_q_lock; +struct work_struct netdev_work;atomic_t sap_seq_no;atomic_t seq_no;
@@ -591,6 +594,33 @@ static rx_handler_result_t iwl_mei_rx_handler(struct sk_buff **pskb)return res; } +static void iwl_mei_netdev_work (struct work_struct *wk) +{ +struct iwl_mei *mei = + container_of(wk, struct iwl_mei, netdev_work); +struct net_device *netdev; + +/* +* First take rtnl and only then the mutex to avoid an ABBA +* with iwl_mei_set_netdev() +*/ +rtnl_lock (); +mutex_lock (&iwl_mei_mutex); + + netdev =rcu_dereference_protected (iwl_mei_cache.netdev, +lockdep_is_held (&iwl_mei_mutex)); +if (netdev) { +if (mei->amt_enabled) +netdev_rx_handler_register (netdev, iwl_mei_rx_handler, + mei); +else +netdev_rx_handler_unregister (netdev); + } + +mutex_unlock (&iwl_mei_mutex); +rtnl_unlock (); +} + static void iwl_mei_handle_rx_start_ok(struct mei_cl_device *cldev, const struct iwl_sap_me_msg_start_ok *rsp,
@@ -743,38 +773,23 @@ static void iwl_mei_handle_amt_state(struct mei_cl_device *cldev, const struct iwl_sap_msg_dw *dw) {struct iwl_mei *mei =mei_cldev_get_drvdata (cldev); -struct net_device *netdev; -/* -* First take rtnl and only then the mutex to avoid an ABBA -* with iwl_mei_set_netdev() -*/ -rtnl_lock ();mutex_lock (&iwl_mei_mutex); - netdev =rcu_dereference_protected (iwl_mei_cache.netdev, -lockdep_is_held (&iwl_mei_mutex)); -if (mei->amt_enabled == !!le32_to_cpu (dw->val)) goto out; mei->amt_enabled = dw->val; -if (mei->amt_enabled) { -if (netdev) -netdev_rx_handler_register (netdev, iwl_mei_rx_handler, mei); - +if (mei->amt_enabled)iwl_mei_set_init_conf (mei); - }else { -if (iwl_mei_cache.ops) - iwl_mei_cache.ops->rfkill (iwl_mei_cache.priv, false); -if (netdev) -netdev_rx_handler_unregister (netdev); - } +else if (iwl_mei_cache.ops) + iwl_mei_cache.ops->rfkill (iwl_mei_cache.priv, false, false); + +schedule_work (&mei->netdev_work); out:mutex_unlock (&iwl_mei_mutex); -rtnl_unlock (); } static void iwl_mei_handle_nic_owner(struct mei_cl_device *cldev,
@@ -1827,6 +1842,7 @@ static int iwl_mei_probe(struct mei_cl_device *cldev, iwl_mei_csa_throttle_end_wk);init_waitqueue_head (&mei->get_ownership_wq);spin_lock_init (&mei->data_q_lock); +INIT_WORK (&mei->netdev_work, iwl_mei_netdev_work);mei_cldev_set_drvdata (cldev, mei); mei->cldev = cldev;
@@ -1989,6 +2005,7 @@ static void iwl_mei_remove(struct mei_cl_device *cldev)*/ cancel_work_sync (&mei->send_csa_msg_wk);cancel_delayed_work_sync (&mei->csa_throttle_end_wk); +cancel_work_sync (&mei->netdev_work);/* * If someone waits for the ownership, let him know that we are going
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 322/1146 wifi: iwlwifi: mei: fix potential NULL-ptr deref after clone
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit d3df49dda431f7ae4132a9a0ac25a5134c04e812 ]
If cloning the SKB fails, don't try to use it, but rather return as if we should pass it.
Coverity CID: 1503456
--- drivers/net/wireless/intel/iwlwifi/mei/net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/net.c +7 -3
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (C) 2021 Intel Corporation +* Copyright (C) 2021-2022 Intel Corporation */ #include <uapi/linux/if_ether.h>
@@ -337,10 +337,14 @@ rx_handler_result_t iwl_mei_rx_filter(struct sk_buff *orig_skb,if (!*pass_to_csme)return RX_HANDLER_PASS ; -if (ret ==RX_HANDLER_PASS ) +if (ret ==RX_HANDLER_PASS ) { skb =skb_copy (orig_skb,GFP_ATOMIC ); -else + +if (!skb) +return RX_HANDLER_PASS ; + }else { skb = orig_skb; + }/* CSME wants the MAC header as well, push it back */ skb_push (skb, skb->data -skb_mac_header (skb));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 323/1146 module: Fix NULL vs IS_ERR checking for module_get_next_page
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 45af1d7aae7d5520d2858f8517a1342646f015db ]
The module_get_next_page() function return error pointers on error instead of NULL.
Use IS_ERR() to check the return value to fix this.
--- kernel/module/decompress.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/module/decompress.c +4 -4
@@ -114,8 +114,8 @@ static ssize_t module_gzip_decompress(struct load_info *info, do { struct page *page = module_get_next_page(info); - if (!page) { - retval = -ENOMEM; + if (IS_ERR(page)) { + retval = PTR_ERR(page); goto out_inflate_end; }
@@ -173,8 +173,8 @@ static ssize_t module_xz_decompress(struct load_info *info, do { struct page *page = module_get_next_page(info); - if (!page) { - retval = -ENOMEM; + if (IS_ERR(page)) { + retval = PTR_ERR(page); goto out; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 324/1146 ASoC: codecs: wsa883x: Use proper shutdown GPIO polarity
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit ec5dba73f7ba10797904cf18092d2e6975a22147 ]
The shutdown GPIO is active low (SD_N), but this depends on actual board layout. Linux drivers should only care about logical state, where high
(1) means shutdown and low (0) means do not shutdown.
Invert the GPIO to match logical value.
--- sound/soc/codecs/wsa883x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wsa883x.c +2 -2
@@ -1392,7 +1392,7 @@ static int wsa883x_probe(struct sdw_slave *pdev, } wsa883x->sd_n =devm_gpiod_get_optional (&pdev->dev,"powerdown" , -GPIOD_FLAGS_BIT_NONEXCLUSIVE ); +GPIOD_FLAGS_BIT_NONEXCLUSIVE |GPIOD_OUT_HIGH );if (IS_ERR (wsa883x->sd_n)) {dev_err (&pdev->dev,"Shutdown Control GPIO not found\n" ); ret =PTR_ERR (wsa883x->sd_n);
@@ -1411,7 +1411,7 @@ static int wsa883x_probe(struct sdw_slave *pdev, pdev->prop.simple_clk_stop_capable = true; pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; pdev->prop.scp_int1_mask =SDW_SCP_INT1_BUS_CLASH |SDW_SCP_INT1_PARITY ; -gpiod_direction_output (wsa883x->sd_n,1 ); +gpiod_direction_output (wsa883x->sd_n,0 ); wsa883x->regmap =devm_regmap_init_sdw (pdev, &wsa883x_regmap_config);if (IS_ERR (wsa883x->regmap)) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 325/1146 ASoC: codecs: wsa883x: use correct header file
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 5f52ceddc40cd61b1dd2ecf735624deaf05f779f ]
Fix build errors when GPIOLIB is not set/enabled:
../sound/soc/codecs/wsa883x.c: In function 'wsa883x_probe':../sound/soc/codecs/wsa883x.c:1394:25: error: implicit declaration of function 'devm_gpiod_get_optional'; did you mean 'devm_regulator_get_optional'? [-Werror=implicit-function-declaration]
wsa883x->sd_n = devm_gpiod_get_optional(&pdev->dev, "powerdown",
../sound/soc/codecs/wsa883x.c:1395:49: error: 'GPIOD_FLAGS_BIT_NONEXCLUSIVE' undeclared (first use in this function)
GPIOD_FLAGS_BIT_NONEXCLUSIVE);
../sound/soc/codecs/wsa883x.c:1414:9: error: implicit declaration of function 'gpiod_direction_output'; did you mean 'gpio_direction_output'? [-Werror=implicit-function-declaration]
gpiod_direction_output(wsa883x->sd_n, 1);--- sound/soc/codecs/wsa883x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wsa883x.c +1 -1
@@ -7,7 +7,7 @@#include <linux/debugfs.h> #include <linux/delay.h> #include <linux/device.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h>
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 326/1146 selftests/bpf: Fix xdp_synproxy compilation failure in 32-bit arch
In reply to Greg Kroah-HartmanFrom: Yang Jihong <[email protected]>
[ Upstream commit e4c9cf0ce8c413c2030e8fb215551d7e0582ee7b ]
xdp_synproxy fails to be compiled in the 32-bit arch, log is as follows:
xdp_synproxy.c: In function 'parse_options':
xdp_synproxy.c:175:36: error: left shift count >= width of type [-Werror=shift-count-overflow]
175 | *tcpipopts = (mss6 << 32) | (ttl << 24) | (wscale << 16) | mss4;
| ^~
xdp_synproxy.c: In function 'syncookie_open_bpf_maps':
xdp_synproxy.c:289:28: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
289 | .map_ids = (__u64)map_ids,
| ^Fix it.
--- tools/testing/selftests/bpf/xdp_synproxy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/xdp_synproxy.c +3 -2
@@ -104,7 +104,8 @@ static void parse_options(int argc, char *argv[], unsigned int *ifindex, __u32 * { "tc", no_argument, NULL, 'c' }, { NULL, 0, NULL, 0 }, }; -unsigned long mss4, mss6, wscale, ttl; +unsigned long mss4, wscale, ttl; +unsigned long long mss6;unsigned int tcpipopts_mask =0 ;if (argc <2 )
@@ -286,7 +287,7 @@ static int syncookie_open_bpf_maps(__u32 prog_id, int *values_map_fd, int *ports prog_info = (struct bpf_prog_info ) { .nr_map_ids =8 , - .map_ids = (__u64 )map_ids, + .map_ids = (__u64 )(unsigned long )map_ids, }; info_len =sizeof (prog_info);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 327/1146 selftests/bpf: Fix incorrect ASSERT in the tcp_hdr_options test
In reply to Greg Kroah-HartmanFrom: Martin KaFai Lau <[email protected]>
[ Upstream commit 52929912d7bda040b43538e8d88e8d231b76eb4e ]
This patch fixes the incorrect ASSERT test in tcp_hdr_options during the CHECK to ASSERT macro cleanup.
--- tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c +2 -2
@@ -485,7 +485,7 @@ static void misc(void) goto check_linum; ret =read (sk_fds.passive_fd, recv_msg,sizeof (recv_msg)); -if (ASSERT_EQ (ret,sizeof (send_msg),"read(msg)" )) +if (!ASSERT_EQ (ret,sizeof (send_msg),"read(msg)" )) goto check_linum; }
@@ -539,7 +539,7 @@ void test_tcp_hdr_options(void) goto skel_destroy; cg_fd =test__join_cgroup (CG_NAME ); -if (ASSERT_GE (cg_fd,0 ,"join_cgroup" )) +if (!ASSERT_GE (cg_fd,0 ,"join_cgroup" )) goto skel_destroy;for (i =0 ; i <ARRAY_SIZE (tests); i++) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 328/1146 drm/mediatek: Modify dpi power on/off sequence.
In reply to Greg Kroah-HartmanFrom: Xinlei Lee <[email protected]>
[ Upstream commit ff446c0f6290185cefafe3b376bb86063a3a9f6a ]
Modify dpi power on/off sequence so that the first gpio operation will take effect.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +6 -6
@@ -461,9 +461,6 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)if (--dpi->refcount !=0 )return ; -if (dpi->pinctrl && dpi->pins_gpio) -pinctrl_select_state (dpi->pinctrl, dpi->pins_gpio); -mtk_dpi_disable (dpi);clk_disable_unprepare (dpi->pixel_clk);clk_disable_unprepare (dpi->engine_clk);
@@ -488,9 +485,6 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) goto err_pixel; } -if (dpi->pinctrl && dpi->pins_dpi) -pinctrl_select_state (dpi->pinctrl, dpi->pins_dpi); -return 0 ; err_pixel:
@@ -721,12 +715,18 @@ static void mtk_dpi_bridge_disable(struct drm_bridge *bridge)struct mtk_dpi *dpi =bridge_to_dpi (bridge);mtk_dpi_power_off (dpi); + +if (dpi->pinctrl && dpi->pins_gpio) +pinctrl_select_state (dpi->pinctrl, dpi->pins_gpio); }static void mtk_dpi_bridge_enable (struct drm_bridge *bridge) {struct mtk_dpi *dpi =bridge_to_dpi (bridge); +if (dpi->pinctrl && dpi->pins_dpi) +pinctrl_select_state (dpi->pinctrl, dpi->pins_dpi); +mtk_dpi_power_on (dpi);mtk_dpi_set_display_mode (dpi, &dpi->mode);mtk_dpi_enable (dpi);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 329/1146 ASoC: pxa: fix null-pointer dereference in filter()
In reply to Greg Kroah-HartmanFrom: Zeng Heng <[email protected]>
[ Upstream commit ec7bf231aaa1bdbcb69d23bc50c753c80fb22429 ]
kasprintf() would return NULL pointer when kmalloc() fail to allocate. Need to check the return pointer before calling strcmp().
--- sound/soc/pxa/mmp-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/pxa/mmp-pcm.c +1 -1
@@ -98,7 +98,7 @@ static bool filter(struct dma_chan *chan, void *param) devname =kasprintf (GFP_KERNEL ,"%s.%d" , dma_data->dma_res->name, dma_data->ssp_id); -if ((strcmp (dev_name (chan->device->dev), devname) ==0 ) && +if (devname && (strcmp (dev_name (chan->device->dev), devname) ==0 ) && (chan->chan_id == dma_data->dma_res->start)) { found = true; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 330/1146 nvmet: only allocate a single slab for bvecs
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit fa8f9ac42350edd3ce82d0d148a60f0fa088f995 ]
There is no need to have a separate slab cache for each namespace, and having separate ones creates duplicate debugs file names as well.
--- drivers/nvme/target/core.c | 22 ++++++++++++++-------- drivers/nvme/target/io-cmd-file.c | 16 +++------------- drivers/nvme/target/nvmet.h | 3 ++- 3 files changed, 19 insertions(+), 22 deletions(-)
drivers/nvme/target/core.c +14 -8
@@ -15,6 +15,7 @@#include "nvmet.h" +struct kmem_cache *nvmet_bvec_cache;struct workqueue_struct *buffered_io_wq;struct workqueue_struct *zbd_wq;static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX ];
@@ -1631,26 +1632,28 @@ void nvmet_subsys_put(struct nvmet_subsys *subsys)static int __init nvmet_init (void ) { -int error; +int error = -ENOMEM ; nvmet_ana_group_enabled[NVMET_DEFAULT_ANA_GRPID ] =1 ; + nvmet_bvec_cache =kmem_cache_create ("nvmet-bvec" , +NVMET_MAX_MPOOL_BVEC *sizeof (struct bio_vec ),0 , +SLAB_HWCACHE_ALIGN ,NULL ); +if (!nvmet_bvec_cache) +return -ENOMEM ; + zbd_wq =alloc_workqueue ("nvmet-zbd-wq" ,WQ_MEM_RECLAIM ,0 );if (!zbd_wq) -return -ENOMEM ; + goto out_destroy_bvec_cache; buffered_io_wq =alloc_workqueue ("nvmet-buffered-io-wq" ,WQ_MEM_RECLAIM ,0 ); -if (!buffered_io_wq) { - error = -ENOMEM ; +if (!buffered_io_wq) goto out_free_zbd_work_queue; - } nvmet_wq =alloc_workqueue ("nvmet-wq" ,WQ_MEM_RECLAIM ,0 ); -if (!nvmet_wq) { - error = -ENOMEM ; +if (!nvmet_wq) goto out_free_buffered_work_queue; - } error =nvmet_init_discovery ();if (error)
@@ -1669,6 +1672,8 @@ static int __init nvmet_init(void)destroy_workqueue (buffered_io_wq); out_free_zbd_work_queue:destroy_workqueue (zbd_wq); +out_destroy_bvec_cache: +kmem_cache_destroy (nvmet_bvec_cache);return error; }
@@ -1680,6 +1685,7 @@ static void __exit nvmet_exit(void)destroy_workqueue (nvmet_wq);destroy_workqueue (buffered_io_wq);destroy_workqueue (zbd_wq); +kmem_cache_destroy (nvmet_bvec_cache);BUILD_BUG_ON (sizeof (struct nvmf_disc_rsp_page_entry ) !=1024 );BUILD_BUG_ON (sizeof (struct nvmf_disc_rsp_page_hdr ) !=1024 );
drivers/nvme/target/io-cmd-file.c +3 -13
@@ -11,7 +11,6 @@#include <linux/fs.h> #include "nvmet.h" -#define NVMET_MAX_MPOOL_BVEC 16#define NVMET_MIN_MPOOL_OBJ 16void nvmet_file_ns_revalidate (struct nvmet_ns *ns)
@@ -26,8 +25,6 @@ void nvmet_file_ns_disable(struct nvmet_ns *ns)flush_workqueue (buffered_io_wq);mempool_destroy (ns->bvec_pool); ns->bvec_pool =NULL ; -kmem_cache_destroy (ns->bvec_cache); - ns->bvec_cache =NULL ;fput (ns->file); ns->file =NULL ; }
@@ -59,16 +56,8 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) ns->blksize_shift =min_t (u8,file_inode (ns->file)->i_blkbits,12 ); - ns->bvec_cache =kmem_cache_create ("nvmet-bvec" , -NVMET_MAX_MPOOL_BVEC *sizeof (struct bio_vec ), -0 ,SLAB_HWCACHE_ALIGN ,NULL ); -if (!ns->bvec_cache) { - ret = -ENOMEM ; - goto err; - } - ns->bvec_pool =mempool_create (NVMET_MIN_MPOOL_OBJ , mempool_alloc_slab, - mempool_free_slab, ns->bvec_cache); + mempool_free_slab, nvmet_bvec_cache);if (!ns->bvec_pool) { ret = -ENOMEM ;
@@ -77,9 +66,10 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)return ret; err: +fput (ns->file); + ns->file =NULL ; ns->size =0 ; ns->blksize_shift =0 ; -nvmet_file_ns_disable (ns);return ret; }
drivers/nvme/target/nvmet.h +2 -1
@@ -77,7 +77,6 @@ struct nvmet_ns {struct completion disable_done;mempool_t *bvec_pool; -struct kmem_cache *bvec_cache;int use_p2pmem;struct pci_dev *p2p_dev;
@@ -393,6 +392,8 @@ struct nvmet_req {u64 error_slba; }; +#define NVMET_MAX_MPOOL_BVEC 16 +extern struct kmem_cache *nvmet_bvec_cache;extern struct workqueue_struct *buffered_io_wq;extern struct workqueue_struct *zbd_wq;extern struct workqueue_struct *nvmet_wq;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 331/1146 regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit f2b41b748c19962b82709d9f23c6b2b0ce9d2f91 ]
I got the the following report:
OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry:
attach overlay node /i2c/pmic@62/regulators/exten
In of_get_regulator(), the node is returned from of_parse_phandle() with refcount incremented, after using it, of_node_put() need be called.
--- drivers/regulator/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/core.c +1 -0
@@ -1943,6 +1943,7 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev, node =of_get_regulator (dev, supply);if (node) { r =of_find_regulator_by_node (node); +of_node_put (node);if (r)return r;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 332/1146 amdgpu/pm: prevent array underflow in vega20_odn_edit_dpm_table()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d27252b5706e51188aed7647126e44dcf9e940c1 ]
In the PP_OD_EDIT_VDDC_CURVE case the "input_index" variable is capped at 2 but not checked for negative values so it results in an out of bounds read. This value comes from the user via sysfs.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +2 -1
@@ -2961,7 +2961,8 @@ static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr, data->od8_settings.od8_settings_array;OverDriveTable_t *od_table = &(data->smc_state_table.overdrive_table); -int32_t input_index, input_clk, input_vol, i; +int32_t input_clk, input_vol, i; +uint32_t input_index;int od8_id;int ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 333/1146 nvme: return err on nvme_init_non_mdts_limits fail
In reply to Greg Kroah-HartmanFrom: Joel Granados <[email protected]>
[ Upstream commit bcaf434b8f04e1ee82a8b1e1bce0de99fbff67fa ]
In nvme_init_non_mdts_limits function we were returning 0 when kzalloc failed; it now returns -ENOMEM.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -3049,7 +3049,7 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl) id =kzalloc (sizeof (*id),GFP_KERNEL );if (!id) -return 0 ; +return -ENOMEM ; c.identify.opcode = nvme_admin_identify; c.identify.cns =NVME_ID_CNS_CS_CTRL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 334/1146 wifi: rtw89: Fix some error handling path in rtw89_core_sta_assoc()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 81c0b8928437ddfe87b0024c5bd817bc331d8524 ]
'ret' is not updated after a function call in rtw89_core_sta_assoc(). This prevent error handling from working.
Add the missing assignment.
--- drivers/net/wireless/realtek/rtw89/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.c +1 -1
@@ -2527,7 +2527,7 @@ int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev, }/* update cam aid mac_id net_type */ -rtw89_fw_h2c_cam (rtwdev, rtwvif, rtwsta,NULL ); + ret =rtw89_fw_h2c_cam (rtwdev, rtwvif, rtwsta,NULL );if (ret) {rtw89_warn (rtwdev,"failed to send h2c cam\n" );return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 335/1146 regulator: qcom-rpmh: Fix PMR735a S3 regulator spec
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit dd801b2265c81bf0c8b0b4b8f7c1e7bfed078403 ]
PMR735a has a wider range than previously defined. Fix it.
--- drivers/regulator/qcom-rpmh-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/qcom-rpmh-regulator.c +1 -1
@@ -1187,7 +1187,7 @@ static const struct rpmh_vreg_init_data pm7325_vreg_data[] = {static const struct rpmh_vreg_init_data pmr735a_vreg_data[] = {RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps520,"vdd-s1" ),RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps520,"vdd-s2" ), -RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_hfsmps510,"vdd-s3" ), +RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_hfsmps515,"vdd-s3" ),RPMH_VREG ("ldo1" ,"ldo%s1" , &pmic5_nldo,"vdd-l1-l2" ),RPMH_VREG ("ldo2" ,"ldo%s2" , &pmic5_nldo,"vdd-l1-l2" ),RPMH_VREG ("ldo3" ,"ldo%s3" , &pmic5_nldo,"vdd-l3" ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 336/1146 drm/fourcc: Fix vsub/hsub for Q410 and Q401
In reply to Greg Kroah-HartmanFrom: Brian Starkey <[email protected]>
[ Upstream commit b230555f3257f197dd98641ef6ebaf778b52dd51 ]
These formats are not subsampled, but that means hsub and vsub should be 1, not 0.
--- drivers/gpu/drm/drm_fourcc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_fourcc.c +4 -4
@@ -297,12 +297,12 @@ const struct drm_format_info *__drm_format_info(u32 format) .vsub = 2, .is_yuv = true }, { .format = DRM_FORMAT_Q410, .depth = 0, .num_planes = 3, .char_per_block = { 2, 2, 2 }, - .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 0, - .vsub = 0, .is_yuv = true }, + .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 1, + .vsub = 1, .is_yuv = true }, { .format = DRM_FORMAT_Q401, .depth = 0, .num_planes = 3, .char_per_block = { 2, 2, 2 }, - .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 0, - .vsub = 0, .is_yuv = true }, + .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 1, + .vsub = 1, .is_yuv = true }, { .format = DRM_FORMAT_P030, .depth = 0, .num_planes = 2, .char_per_block = { 4, 8, 0 }, .block_w = { 3, 3, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true},
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 337/1146 ALSA: memalloc: Allocate more contiguous pages for fallback case
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit cc26516374065a34e10c9a8bf3e940e42cd96e2a ]
Currently the fallback SG allocation tries to allocate each single page, and this tends to result in the reverse order of memory addresses when large space is available at boot, as the kernel takes a free page from the top to the bottom in the zone. The end result looks as if non-contiguous (although it actually is). What's worse is that it leads to an overflow of BDL entries for HD-audio.
For avoiding such a problem, this patch modifies the allocation code slightly; now it tries to allocate the larger contiguous chunks as much as possible, then reduces to the smaller chunks only if the allocation failed -- a similar strategy as the existing snd_dma_alloc_pages_fallback() function.
Along with the trick, drop the unused address array from snd_dma_sg_fallback object. It was needed in the past when dma_alloc_coherent() was used, but with the standard page allocator, it became superfluous and never referred.
--- sound/core/memalloc.c | 44 ++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-)
sound/core/memalloc.c +27 -17
@@ -720,7 +720,6 @@ static const struct snd_malloc_ops snd_dma_sg_wc_ops = {struct snd_dma_sg_fallback {size_t count;struct page **pages; -dma_addr_t *addrs; }; static void __snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab,
@@ -732,38 +731,49 @@ static void __snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab,for (i =0 ; i < sgbuf->count && sgbuf->pages[i]; i++)do_free_pages (page_address (sgbuf->pages[i]),PAGE_SIZE , wc);kvfree (sgbuf->pages); -kvfree (sgbuf->addrs);kfree (sgbuf); }static void *snd_dma_sg_fallback_alloc (struct snd_dma_buffer *dmab,size_t size) {struct snd_dma_sg_fallback *sgbuf; -struct page **pages; -size_t i, count; +struct page **pagep, *curp; +size_t chunk, npages; +dma_addr_t addr;void *p;bool wc = dmab->dev.type ==SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK ; sgbuf =kzalloc (sizeof (*sgbuf),GFP_KERNEL );if (!sgbuf)return NULL ; - count =PAGE_ALIGN (size) >>PAGE_SHIFT ; - pages =kvcalloc (count,sizeof (*pages),GFP_KERNEL ); -if (!pages) - goto error; - sgbuf->pages = pages; - sgbuf->addrs =kvcalloc (count,sizeof (*sgbuf->addrs),GFP_KERNEL ); -if (!sgbuf->addrs) + size =PAGE_ALIGN (size); + sgbuf->count = size >>PAGE_SHIFT ; + sgbuf->pages =kvcalloc (sgbuf->count,sizeof (*sgbuf->pages),GFP_KERNEL ); +if (!sgbuf->pages) goto error; -for (i =0 ; i < count; sgbuf->count++, i++) { - p =do_alloc_pages (dmab->dev.dev,PAGE_SIZE , &sgbuf->addrs[i], wc); -if (!p) - goto error; - sgbuf->pages[i] =virt_to_page (p); + pagep = sgbuf->pages; + chunk = size; +while (size >0 ) { + chunk =min (size, chunk); + p =do_alloc_pages (dmab->dev.dev, chunk, &addr, wc); +if (!p) { +if (chunk <=PAGE_SIZE ) + goto error; + chunk >>=1 ; + chunk =PAGE_SIZE <<get_order (chunk); +continue ; + } + + size -= chunk; +/* fill pages */ + npages = chunk >>PAGE_SHIFT ; + curp =virt_to_page (p); +while (npages--) + *pagep++ = curp++; } - p =vmap (pages, count,VM_MAP ,PAGE_KERNEL ); + p =vmap (sgbuf->pages, sgbuf->count,VM_MAP ,PAGE_KERNEL );if (!p) goto error; dmab->private_data = sgbuf;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 338/1146 integrity: Fix memory leakage in keyring allocation error path
In reply to Greg Kroah-HartmanFrom: GUO Zihua <[email protected]>
[ Upstream commit 39419ef7af0916cc3620ecf1ed42d29659109bf3 ]
Key restriction is allocated in integrity_init_keyring(). However, if keyring allocation failed, it is not freed, causing memory leaks.
--- security/integrity/digsig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
security/integrity/digsig.c +5 -1
@@ -126,6 +126,7 @@ int __init integrity_init_keyring(const unsigned int id) {struct key_restriction *restriction;key_perm_t perm; +int ret; perm = (KEY_POS_ALL & ~KEY_POS_SETATTR ) |KEY_USR_VIEW |KEY_USR_READ |KEY_USR_SEARCH ;
@@ -154,7 +155,10 @@ int __init integrity_init_keyring(const unsigned int id) perm |=KEY_USR_WRITE ; out: -return __integrity_init_keyring (id, perm, restriction); + ret =__integrity_init_keyring (id, perm, restriction); +if (ret) +kfree (restriction); +return ret; } static int __init integrity_add_key(const unsigned int id, const void *data,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 339/1146 ima: Fix misuse of dereference of pointer in template_desc_init_fields()
In reply to Greg Kroah-HartmanFrom: Xiu Jianfeng <[email protected]>
[ Upstream commit 25369175ce84813dd99d6604e710dc2491f68523 ]
The input parameter @fields is type of struct ima_template_field ***, so when allocates array memory for @fields, the size of element should be sizeof(**field) instead of sizeof(*field).
Actually the original code would not cause any runtime error, but it's better to make it logically right.
--- security/integrity/ima/ima_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/integrity/ima/ima_template.c +2 -2
@@ -245,11 +245,11 @@ int template_desc_init_fields(const char *template_fmt, }if (fields && num_fields) { - *fields =kmalloc_array (i,sizeof (*fields),GFP_KERNEL ); + *fields =kmalloc_array (i,sizeof (**fields),GFP_KERNEL );if (*fields ==NULL )return -ENOMEM ; -memcpy (*fields, found_fields, i *sizeof (*fields)); +memcpy (*fields, found_fields, i *sizeof (**fields)); *num_fields = i; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 340/1146 block: clear ->slave_dir when dropping the main slave_dir reference
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit d90db3b1c8676bc88b4309c5a571333de2263b8e ]
Zero out the pointer to ->slave_dir so that the holder code doesn't incorrectly treat the object as alive when add_disk failed or after del_gendisk was called.
--- block/genhd.c | 2 ++ 1 file changed, 2 insertions(+)
block/genhd.c +2 -0
@@ -530,6 +530,7 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,rq_qos_exit (disk->queue); out_put_slave_dir:kobject_put (disk->slave_dir); + disk->slave_dir =NULL ; out_put_holder_dir:kobject_put (disk->part0->bd_holder_dir); out_del_integrity:
@@ -629,6 +630,7 @@ void del_gendisk(struct gendisk *disk)kobject_put (disk->part0->bd_holder_dir);kobject_put (disk->slave_dir); + disk->slave_dir =NULL ;part_stat_set_all (disk->part0,0 ); disk->part0->bd_stamp =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 341/1146 dm: cleanup open_table_device
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit b9a785d2dc6567b2fd9fc60057a6a945a276927a ]
Move all the logic for allocation the table_device and linking it into the list into the open_table_device. This keeps the code tidy and ensures that the table_devices only exist in fully initialized state.
Stable-dep-of: 1a581b721699 ("dm: track per-add_disk holder relations in DM")
--- drivers/md/dm.c | 56 ++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 29 deletions(-)
drivers/md/dm.c +27 -29
@@ -732,28 +732,41 @@ static char *_dm_claim_ptr = "I belong to device-mapper";/* * Open a table device so we can use it as a map destination. */ -static int open_table_device (struct table_device *td,dev_t dev, -struct mapped_device *md) +static struct table_device *open_table_device (struct mapped_device *md, +dev_t dev,fmode_t mode) { +struct table_device *td;struct block_device *bdev;u64 part_off;int r; -BUG_ON (td->dm_dev.bdev); + td =kmalloc_node (sizeof (*td),GFP_KERNEL , md->numa_node_id); +if (!td) +return ERR_PTR (-ENOMEM ); +refcount_set (&td->count,1 ); - bdev =blkdev_get_by_dev (dev, td->dm_dev.mode |FMODE_EXCL , _dm_claim_ptr); -if (IS_ERR (bdev)) -return PTR_ERR (bdev); + bdev =blkdev_get_by_dev (dev, mode |FMODE_EXCL , _dm_claim_ptr); +if (IS_ERR (bdev)) { + r =PTR_ERR (bdev); + goto out_free_td; + } r =bd_link_disk_holder (bdev,dm_disk (md)); -if (r) { -blkdev_put (bdev, td->dm_dev.mode |FMODE_EXCL ); -return r; - } +if (r) + goto out_blkdev_put; + td->dm_dev.mode = mode; td->dm_dev.bdev = bdev; td->dm_dev.dax_dev =fs_dax_get_by_bdev (bdev, &part_off,NULL ,NULL ); -return 0 ; +format_dev_t (td->dm_dev.name, dev); +list_add (&td->list, &md->table_devices); +return td; + +out_blkdev_put: +blkdev_put (bdev, mode |FMODE_EXCL ); +out_free_td: +kfree (td); +return ERR_PTR (r); }/*
@@ -786,31 +799,16 @@ static struct table_device *find_table_device(struct list_head *l, dev_t dev,int dm_get_table_device (struct mapped_device *md,dev_t dev,fmode_t mode,struct dm_dev **result) { -int r;struct table_device *td;mutex_lock (&md->table_devices_lock); td =find_table_device (&md->table_devices, dev, mode);if (!td) { - td =kmalloc_node (sizeof (*td),GFP_KERNEL , md->numa_node_id); -if (!td) { -mutex_unlock (&md->table_devices_lock); -return -ENOMEM ; - } - - td->dm_dev.mode = mode; - td->dm_dev.bdev =NULL ; - -if ((r =open_table_device (td, dev, md))) { + td =open_table_device (md, dev, mode); +if (IS_ERR (td)) {mutex_unlock (&md->table_devices_lock); -kfree (td); -return r; +return PTR_ERR (td); } - -format_dev_t (td->dm_dev.name, dev); - -refcount_set (&td->count,1 ); -list_add (&td->list, &md->table_devices); }else {refcount_inc (&td->count); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 342/1146 dm: cleanup close_table_device
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 7b5865831c1003122f737df5e16adaa583f1a595 ]
Take the list unlink and free into close_table_device so that no half torn down table_devices exist. Also remove the check for a NULL bdev as that can't happen - open_table_device never adds a table_device to the list that does not have a valid block_device.
Stable-dep-of: 1a581b721699 ("dm: track per-add_disk holder relations in DM")
--- drivers/md/dm.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/md/dm.c +3 -9
@@ -774,14 +774,11 @@ static struct table_device *open_table_device(struct mapped_device *md,*/ static void close_table_device (struct table_device *td,struct mapped_device *md) { -if (!td->dm_dev.bdev) -return ; -bd_unlink_disk_holder (td->dm_dev.bdev,dm_disk (md));blkdev_put (td->dm_dev.bdev, td->dm_dev.mode |FMODE_EXCL );put_dax (td->dm_dev.dax_dev); - td->dm_dev.bdev =NULL ; - td->dm_dev.dax_dev =NULL ; +list_del (&td->list); +kfree (td); } static struct table_device *find_table_device(struct list_head *l, dev_t dev,
@@ -823,11 +820,8 @@ void dm_put_table_device(struct mapped_device *md, struct dm_dev *d) struct table_device *td = container_of(d, struct table_device, dm_dev);mutex_lock (&md->table_devices_lock); -if (refcount_dec_and_test (&td->count)) { +if (refcount_dec_and_test (&td->count))close_table_device (td, md); -list_del (&td->list); -kfree (td); - }mutex_unlock (&md->table_devices_lock); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 343/1146 dm: make sure create and remove dm device wont race with open and close table
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit d563792c8933a810d28ce0f2831f0726c2b15a31 ]
open_table_device() and close_table_device() is protected by table_devices_lock, hence use it to protect add_disk() and del_gendisk().
Prepare to track per-add_disk holder relations in dm.
Stable-dep-of: 1a581b721699 ("dm: track per-add_disk holder relations in DM")
--- drivers/md/dm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/md/dm.c +16 -0
@@ -1965,7 +1965,14 @@ static void cleanup_mapped_device(struct mapped_device *md)spin_unlock (&_minor_lock);if (dm_get_md_type (md) !=DM_TYPE_NONE ) {dm_sysfs_exit (md); + +/* +* Hold lock to make sure del_gendisk() won't concurrent +* with open/close_table_device(). +*/ +mutex_lock (&md->table_devices_lock);del_gendisk (md->disk); +mutex_unlock (&md->table_devices_lock); }dm_queue_destroy_crypto_profile (md->queue);put_disk (md->disk);
@@ -2325,15 +2332,24 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)if (r)return r; +/* +* Hold lock to make sure add_disk() and del_gendisk() won't concurrent +* with open_table_device() and close_table_device(). +*/ +mutex_lock (&md->table_devices_lock); r =add_disk (md->disk); +mutex_unlock (&md->table_devices_lock);if (r)return r; r =dm_sysfs_init (md);if (r) { +mutex_lock (&md->table_devices_lock);del_gendisk (md->disk); +mutex_unlock (&md->table_devices_lock);return r; } + md->type = type;return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 344/1146 dm: track per-add_disk holder relations in DM
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 1a581b72169968f4154b5793828f3bc28b258b35 ]
dm is a bit special in that it opens the underlying devices. Commit 89f871af1b26 ("dm: delay registering the gendisk") tried to accommodate that by allowing to add the holder to the list before add_gendisk and then just add them to sysfs once add_disk is called. But that leads to really odd lifetime problems and error handling problems as we can't know the state of the kobjects and don't unwind properly. To fix this switch to just registering all existing table_devices with the holder code right after add_disk, and remove them before calling del_gendisk.
--- drivers/md/dm.c | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-)
drivers/md/dm.c +39 -10
@@ -751,9 +751,16 @@ static struct table_device *open_table_device(struct mapped_device *md, goto out_free_td; } - r =bd_link_disk_holder (bdev,dm_disk (md)); -if (r) - goto out_blkdev_put; +/* +* We can be called before the dm disk is added. In that case we can't +* register the holder relation here. It will be done once add_disk was +* called. +*/ +if (md->disk->slave_dir) { + r =bd_link_disk_holder (bdev, md->disk); +if (r) + goto out_blkdev_put; + } td->dm_dev.mode = mode; td->dm_dev.bdev = bdev;
@@ -774,7 +781,8 @@ static struct table_device *open_table_device(struct mapped_device *md,*/ static void close_table_device (struct table_device *td,struct mapped_device *md) { -bd_unlink_disk_holder (td->dm_dev.bdev,dm_disk (md)); +if (md->disk->slave_dir) +bd_unlink_disk_holder (td->dm_dev.bdev, md->disk);blkdev_put (td->dm_dev.bdev, td->dm_dev.mode |FMODE_EXCL );put_dax (td->dm_dev.dax_dev);list_del (&td->list);
@@ -1964,7 +1972,13 @@ static void cleanup_mapped_device(struct mapped_device *md) md->disk->private_data =NULL ;spin_unlock (&_minor_lock);if (dm_get_md_type (md) !=DM_TYPE_NONE ) { +struct table_device *td; +dm_sysfs_exit (md); +list_for_each_entry (td, &md->table_devices, list) { +bd_unlink_disk_holder (td->dm_dev.bdev, + md->disk); + }/* * Hold lock to make sure del_gendisk() won't concurrent
@@ -2304,6 +2318,7 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) {enum dm_queue_mode type =dm_table_get_type (t);struct queue_limits limits; +struct table_device *td;int r;switch (type) {
@@ -2342,16 +2357,30 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)if (r)return r; - r =dm_sysfs_init (md); -if (r) { -mutex_lock (&md->table_devices_lock); -del_gendisk (md->disk); -mutex_unlock (&md->table_devices_lock); -return r; +/* +* Register the holder relationship for devices added before the disk +* was live. +*/ +list_for_each_entry (td, &md->table_devices, list) { + r =bd_link_disk_holder (td->dm_dev.bdev, md->disk); +if (r) + goto out_undo_holders; } + r =dm_sysfs_init (md); +if (r) + goto out_undo_holders; + md->type = type;return 0 ; + +out_undo_holders: +list_for_each_entry_continue_reverse (td, &md->table_devices, list) +bd_unlink_disk_holder (td->dm_dev.bdev, md->disk); +mutex_lock (&md->table_devices_lock); +del_gendisk (md->disk); +mutex_unlock (&md->table_devices_lock); +return r; }struct mapped_device *dm_get_md (dev_t dev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 345/1146 selftests/bpf: fix memory leak of lsm_cgroup
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit c453e64cbc9532c0c2edfa999c35d29dad16b8bb ]
kmemleak reports this issue:
unreferenced object 0xffff88810b7835c0 (size 32):
comm "test_progs", pid 270, jiffies 4294969007 (age 1621.315s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
03 00 00 00 03 00 00 00 0f 00 00 00 00 00 00 00 ................
backtrace:
[<00000000376cdeab>] kmalloc_trace+0x27/0x110
[<000000003bcdb3b6>] selinux_sk_alloc_security+0x66/0x110
[<000000003959008f>] security_sk_alloc+0x47/0x80
[<00000000e7bc6668>] sk_prot_alloc+0xbd/0x1a0
[<0000000002d6343a>] sk_alloc+0x3b/0x940
[<000000009812a46d>] unix_create1+0x8f/0x3d0
[<000000005ed0976b>] unix_create+0xa1/0x150
[<0000000086a1d27f>] __sock_create+0x233/0x4a0
[<00000000cffe3a73>] __sys_socket_create.part.0+0xaa/0x110
[<0000000007c63f20>] __sys_socket+0x49/0xf0
[<00000000b08753c8>] __x64_sys_socket+0x42/0x50
[<00000000b56e26b3>] do_syscall_64+0x3b/0x90
[<000000009b4871b8>] entry_SYSCALL_64_after_hwframe+0x63/0xcdThe issue occurs in the following scenarios:
unix_create1()
sk_alloc()
sk_prot_alloc()
security_sk_alloc()
call_int_hook()
hlist_for_each_entry()
entry1->hook.sk_alloc_security
<-- selinux_sk_alloc_security() succeeded,
<-- sk->security alloced here.
entry2->hook.sk_alloc_security
<-- bpf_lsm_sk_alloc_security() failed
goto out_free;
... <-- the sk->security not freed, memleakThe core problem is that the LSM is not yet fully stacked (work is actively going on in this space) which means that some LSM hooks do not support multiple LSMs at the same time. To fix, skip the "EPERM" test when it runs in the environments that already have non-bpf lsms installed
--- .../selftests/bpf/prog_tests/lsm_cgroup.c | 17 +++++++++++++---- tools/testing/selftests/bpf/progs/lsm_cgroup.c | 8 ++++++++ 2 files changed, 21 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/prog_tests/lsm_cgroup.c +13 -4
@@ -173,10 +173,12 @@ static void test_lsm_cgroup_functional(void)ASSERT_EQ (query_prog_cnt (cgroup_fd,NULL ),4 ,"total prog count" );ASSERT_EQ (query_prog_cnt (cgroup_fd2,NULL ),1 ,"total prog count" ); -/* AF_UNIX is prohibited. */ - fd =socket (AF_UNIX ,SOCK_STREAM ,0 ); -ASSERT_LT (fd,0 ,"socket(AF_UNIX)" ); +if (!(skel->kconfig->CONFIG_SECURITY_APPARMOR + || skel->kconfig->CONFIG_SECURITY_SELINUX + || skel->kconfig->CONFIG_SECURITY_SMACK)) +/* AF_UNIX is prohibited. */ +ASSERT_LT (fd,0 ,"socket(AF_UNIX)" );close (fd);/* AF_INET6 gets default policy (sk_priority). */
@@ -233,11 +235,18 @@ static void test_lsm_cgroup_functional(void)/* AF_INET6+SOCK_STREAM * AF_PACKET+SOCK_RAW +* AF_UNIX+SOCK_RAW if already have non-bpf lsms installed * listen_fd * client_fd * accepted_fd */ -ASSERT_EQ (skel->bss->called_socket_post_create2,5 ,"called_create2" ); +if (skel->kconfig->CONFIG_SECURITY_APPARMOR + || skel->kconfig->CONFIG_SECURITY_SELINUX + || skel->kconfig->CONFIG_SECURITY_SMACK) +/* AF_UNIX+SOCK_RAW if already have non-bpf lsms installed */ +ASSERT_EQ (skel->bss->called_socket_post_create2,6 ,"called_create2" ); +else +ASSERT_EQ (skel->bss->called_socket_post_create2,5 ,"called_create2" );/* start_server * bind(ETH_P_ALL)
tools/testing/selftests/bpf/progs/lsm_cgroup.c +8 -0
@@ -7,6 +7,10 @@ char _license[] SEC("license") = "GPL"; +extern bool CONFIG_SECURITY_SELINUX __kconfig __weak; +extern bool CONFIG_SECURITY_SMACK __kconfig __weak; +extern bool CONFIG_SECURITY_APPARMOR __kconfig __weak; +#ifndef AF_PACKET #define AF_PACKET 17#endif
@@ -140,6 +144,10 @@ SEC("lsm_cgroup/sk_alloc_security")int BPF_PROG (socket_alloc ,struct sock *sk,int family,gfp_t priority) { called_socket_alloc++; +/* if already have non-bpf lsms installed, EPERM will cause memory leak of non-bpf lsms */ +if (CONFIG_SECURITY_SELINUX ||CONFIG_SECURITY_SMACK ||CONFIG_SECURITY_APPARMOR ) +return 1 ; +if (family ==AF_UNIX )return 0 ;/* EPERM */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 346/1146 wifi: ath10k: Fix return value in ath10k_pci_init()
In reply to Greg Kroah-HartmanFrom: Xiu Jianfeng <[email protected]>
[ Upstream commit 2af7749047d8d6ad43feff69f555a13a6a6c2831 ]
This driver is attempting to register to support two different buses. if either of these is successful then ath10k_pci_init() should return 0 so that hardware attached to the successful bus can be probed and supported. only if both of these are unsuccessful should ath10k_pci_init() return an errno.
--- drivers/net/wireless/ath/ath10k/pci.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +12 -8
@@ -3792,18 +3792,22 @@ static struct pci_driver ath10k_pci_driver = {static int __init ath10k_pci_init (void ) { -int ret; +int ret1, ret2; - ret =pci_register_driver (&ath10k_pci_driver); -if (ret) + ret1 =pci_register_driver (&ath10k_pci_driver); +if (ret1)printk (KERN_ERR "failed to register ath10k pci driver: %d\n" , - ret); + ret1); - ret =ath10k_ahb_init (); -if (ret) -printk (KERN_ERR "ahb init failed: %d\n" , ret); + ret2 =ath10k_ahb_init (); +if (ret2) +printk (KERN_ERR "ahb init failed: %d\n" , ret2); -return ret; +if (ret1 && ret2) +return ret1; + +/* registered to at least one bus */ +return 0 ; }module_init (ath10k_pci_init);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 347/1146 drm/msm/a6xx: Fix speed-bin detection vs probe-defer
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit f6d1918794ef92b4e26b80c3d40365347b76b1fd ]
If we get an error (other than -ENOENT) we need to propagate that up the stack. Otherwise if the nvmem driver hasn't probed yet, we'll end up end up claiming that we support all the OPPs which is not likely to be true (and on some generations impossible to be true, ie. if there are conflicting OPPs).
v2: Update commit msg, gc unused label, etc
v3: Add previously missing \n's
Patchwork: https://patchwork.freedesktop.org/patch/511690/
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +5 -7
@@ -1906,7 +1906,7 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse)if (val ==UINT_MAX ) {DRM_DEV_ERROR (dev, -"missing support for speed-bin: %u. Some OPPs may not be supported by hardware" , +"missing support for speed-bin: %u. Some OPPs may not be supported by hardware\n" , fuse);return UINT_MAX ; }
@@ -1916,7 +1916,7 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse)static int a6xx_set_supported_hw (struct device *dev,struct adreno_rev rev) { -u32 supp_hw =UINT_MAX ; +u32 supp_hw;u32 speedbin;int ret;
@@ -1928,15 +1928,13 @@ static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev)if (ret == -ENOENT ) {return 0 ; }else if (ret) { -DRM_DEV_ERROR (dev, -"failed to read speed-bin (%d). Some OPPs may not be supported by hardware" , - ret); - goto done; +dev_err_probe (dev, ret, +"failed to read speed-bin. Some OPPs may not be supported by hardware\n" ); +return ret; } supp_hw =fuse_to_supp_hw (dev, rev, speedbin); -done: ret =devm_pm_opp_set_supported_hw (dev, &supp_hw,1 );if (ret)return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 348/1146 mtd: lpddr2_nvm: Fix possible null-ptr-deref
In reply to Greg Kroah-HartmanFrom: Hui Tang <[email protected]>
[ Upstream commit 6bdd45d795adf9e73b38ced5e7f750cd199499ff ]
It will cause null-ptr-deref when resource_size(add_range) invoked, if platform_get_resource() returns NULL.
--- drivers/mtd/lpddr/lpddr2_nvm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/lpddr/lpddr2_nvm.c +2 -0
@@ -433,6 +433,8 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)/* lpddr2_nvm address range */ add_range =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!add_range) +return -ENODEV ;/* Populate map_info data structure */ *map = (struct map_info ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 349/1146 Input: elants_i2c - properly handle the reset GPIO when power is off
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit a85fbd6498441694475716a4d5c65f9d3e073faf ]
As can be seen in elants_i2c_power_off(), we want the reset GPIO asserted when power is off. The reset GPIO is active low so we need the reset line logic low when power is off to avoid leakage.
We have a problem, though, at probe time. At probe time we haven't powered the regulators on yet but we have:
devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_LOW);
While that _looks_ right, it turns out that it's not. The GPIOD_OUT_LOW doesn't mean to init the GPIO to low. It means init the GPIO to "not asserted". Since this is an active low GPIO that inits it to be high.
Let's fix this to properly init the GPIO. Now after both probe and power off the state of the GPIO is consistent (it's "asserted" or level low).
Once we fix this, we can see that at power on time we no longer to assert the reset GPIO as the first thing. The reset GPIO is _always_ asserted before powering on. Let's fix powering on to account for this.
--- drivers/input/touchscreen/elants_i2c.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/input/touchscreen/elants_i2c.c +3 -6
@@ -1329,14 +1329,12 @@ static int elants_i2c_power_on(struct elants_data *ts)if (IS_ERR_OR_NULL (ts->reset_gpio))return 0 ; -gpiod_set_value_cansleep (ts->reset_gpio,1 ); - error =regulator_enable (ts->vcc33);if (error) {dev_err (&ts->client->dev,"failed to enable vcc33 regulator: %d\n" , error); - goto release_reset_gpio; +return error; } error =regulator_enable (ts->vccio);
@@ -1345,7 +1343,7 @@ static int elants_i2c_power_on(struct elants_data *ts)"failed to enable vccio regulator: %d\n" , error);regulator_disable (ts->vcc33); - goto release_reset_gpio; +return error; }/*
@@ -1354,7 +1352,6 @@ static int elants_i2c_power_on(struct elants_data *ts)*/ udelay (ELAN_POWERON_DELAY_USEC ); -release_reset_gpio:gpiod_set_value_cansleep (ts->reset_gpio,0 );if (error)return error;
@@ -1462,7 +1459,7 @@ static int elants_i2c_probe(struct i2c_client *client)return error; } - ts->reset_gpio =devm_gpiod_get (&client->dev,"reset" ,GPIOD_OUT_LOW ); + ts->reset_gpio =devm_gpiod_get (&client->dev,"reset" ,GPIOD_OUT_HIGH );if (IS_ERR (ts->reset_gpio)) { error =PTR_ERR (ts->reset_gpio);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 350/1146 ASoC: amd: acp: Fix possible UAF in acp_dma_open
In reply to Greg Kroah-HartmanFrom: Gaosheng Cui <[email protected]>
[ Upstream commit 3420fdb8ae99f0a08d78d2b80f42a71971cf478d ]
Smatch report warning as follows:
sound/soc/amd/acp/acp-platform.c:199 acp_dma_open() warn:
'&stream->list' not removed from list
If snd_pcm_hw_constraint_integer() fails in acp_dma_open(), stream will be freed, but stream->list will not be removed from adata->stream_list, then list traversal may cause UAF.
Fix by adding the newly allocated stream to the list once it's fully initialised.
--- sound/soc/amd/acp/acp-platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/amd/acp/acp-platform.c +4 -4
@@ -184,10 +184,6 @@ static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_subs stream->substream = substream; -spin_lock_irq (&adata->acp_lock); -list_add_tail (&stream->list, &adata->stream_list); -spin_unlock_irq (&adata->acp_lock); -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) runtime->hw = acp_pcm_hardware_playback;else
@@ -203,6 +199,10 @@ static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_subswritel (1 ,ACP_EXTERNAL_INTR_ENB (adata)); +spin_lock_irq (&adata->acp_lock); +list_add_tail (&stream->list, &adata->stream_list); +spin_unlock_irq (&adata->acp_lock); +return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 351/1146 net: ethernet: mtk_eth_soc: do not overwrite mtu configuration running reset routine
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit b677d6c7a695dad1b02d2e0e428c39b3b344f270 ]
Restore user configured MTU running mtk_hw_init() during tx timeout routine since it will be overwritten after a hw reset.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 53 +++++++++++++-------- 1 file changed, 34 insertions(+), 19 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +34 -19
@@ -3229,6 +3229,30 @@ static void mtk_dim_tx(struct work_struct *work) dim->state =DIM_START_MEASURE ; } +static void mtk_set_mcr_max_rx (struct mtk_mac *mac,u32 val) +{ +struct mtk_eth *eth = mac->hw; +u32 mcr_cur, mcr_new; + +if (MTK_HAS_CAPS (eth->soc->caps,MTK_SOC_MT7628 )) +return ; + + mcr_cur =mtk_r32 (mac->hw,MTK_MAC_MCR (mac->id)); + mcr_new = mcr_cur & ~MAC_MCR_MAX_RX_MASK ; + +if (val <=1518 ) + mcr_new |=MAC_MCR_MAX_RX (MAC_MCR_MAX_RX_1518 ); +else if (val <=1536 ) + mcr_new |=MAC_MCR_MAX_RX (MAC_MCR_MAX_RX_1536 ); +else if (val <=1552 ) + mcr_new |=MAC_MCR_MAX_RX (MAC_MCR_MAX_RX_1552 ); +else + mcr_new |=MAC_MCR_MAX_RX (MAC_MCR_MAX_RX_2048 ); + +if (mcr_new != mcr_cur) +mtk_w32 (mac->hw, mcr_new,MTK_MAC_MCR (mac->id)); +} +static int mtk_hw_init (struct mtk_eth *eth) { u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA |
@@ -3303,8 +3327,16 @@ static int mtk_hw_init(struct mtk_eth *eth)* up with the more appropriate value when mtk_mac_config call is being * invoked. */ -for (i =0 ; i <MTK_MAC_COUNT ; i++) +for (i =0 ; i <MTK_MAC_COUNT ; i++) { +struct net_device *dev = eth->netdev[i]; +mtk_w32 (eth,MAC_MCR_FORCE_LINK_DOWN ,MTK_MAC_MCR (i)); +if (dev) { +struct mtk_mac *mac =netdev_priv (dev); + +mtk_set_mcr_max_rx (mac, dev->mtu +MTK_RX_ETH_HLEN ); + } + }/* Indicates CDM to parse the MTK special tag from CPU * which also is working out for untag packets.
@@ -3420,7 +3452,6 @@ static int mtk_change_mtu(struct net_device *dev, int new_mtu)int length = new_mtu +MTK_RX_ETH_HLEN ;struct mtk_mac *mac =netdev_priv (dev);struct mtk_eth *eth = mac->hw; -u32 mcr_cur, mcr_new;if (rcu_access_pointer (eth->prog) && length >MTK_PP_MAX_BUF_SIZE ) {
@@ -3428,23 +3459,7 @@ static int mtk_change_mtu(struct net_device *dev, int new_mtu)return -EINVAL ; } -if (!MTK_HAS_CAPS (eth->soc->caps,MTK_SOC_MT7628 )) { - mcr_cur =mtk_r32 (mac->hw,MTK_MAC_MCR (mac->id)); - mcr_new = mcr_cur & ~MAC_MCR_MAX_RX_MASK ; - -if (length <=1518 ) - mcr_new |=MAC_MCR_MAX_RX (MAC_MCR_MAX_RX_1518 ); -else if (length <=1536 ) - mcr_new |=MAC_MCR_MAX_RX (MAC_MCR_MAX_RX_1536 ); -else if (length <=1552 ) - mcr_new |=MAC_MCR_MAX_RX (MAC_MCR_MAX_RX_1552 ); -else - mcr_new |=MAC_MCR_MAX_RX (MAC_MCR_MAX_RX_2048 ); - -if (mcr_new != mcr_cur) -mtk_w32 (mac->hw, mcr_new,MTK_MAC_MCR (mac->id)); - } - +mtk_set_mcr_max_rx (mac, length); dev->mtu = new_mtu;return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 352/1146 media: amphion: add lock around vdec_g_fmt
In reply to Greg Kroah-HartmanFrom: Ming Qian <[email protected]>
[ Upstream commit 8480dd5fb3c82b5887d456b3fbe4201d99231814 ]
the capture format may be changed when
sequence header is parsed,
it may be read and write in the same time,
add lock around vdec_g_fmt to synchronize it
--- drivers/media/platform/amphion/vdec.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/amphion/vdec.c +2 -0
@@ -286,6 +286,7 @@ static int vdec_g_fmt(struct file *file, void *fh, struct v4l2_format *f)struct vpu_format *cur_fmt;int i; +vpu_inst_lock (inst); cur_fmt =vpu_get_format (inst, f->type); pixmp->pixelformat = cur_fmt->pixfmt;
@@ -303,6 +304,7 @@ static int vdec_g_fmt(struct file *file, void *fh, struct v4l2_format *f) f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs; f->fmt.pix_mp.quantization = vdec->codec_info.full_range; +vpu_inst_unlock (inst);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 353/1146 media: amphion: apply vb2_queue_error instead of setting manually
In reply to Greg Kroah-HartmanFrom: Ming Qian <[email protected]>
[ Upstream commit 9d175a81e28f260916a0a13f457dd8b940eafb4e ]
vb2_queue_error is help to set the error of vb2_queue, don't need to set it manually
--- drivers/media/platform/amphion/vpu_v4l2.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/media/platform/amphion/vpu_v4l2.c +2 -9
@@ -65,18 +65,11 @@ unsigned int vpu_get_buffer_state(struct vb2_v4l2_buffer *vbuf)void vpu_v4l2_set_error (struct vpu_inst *inst) { -struct vb2_queue *src_q; -struct vb2_queue *dst_q; -vpu_inst_lock (inst);dev_err (inst->dev,"some error occurs in codec\n" );if (inst->fh.m2m_ctx) { - src_q =v4l2_m2m_get_src_vq (inst->fh.m2m_ctx); - dst_q =v4l2_m2m_get_dst_vq (inst->fh.m2m_ctx); - src_q->error =1 ; - dst_q->error =1 ; -wake_up (&src_q->done_wq); -wake_up (&dst_q->done_wq); +vb2_queue_error (v4l2_m2m_get_src_vq (inst->fh.m2m_ctx)); +vb2_queue_error (v4l2_m2m_get_dst_vq (inst->fh.m2m_ctx)); }vpu_inst_unlock (inst); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 354/1146 media: vidtv: Fix use-after-free in vidtv_bridge_dvb_init()
In reply to Greg Kroah-HartmanFrom: Chen Zhongjin <[email protected]>
[ Upstream commit ba8d9405935097e296bcf7a942c3a01df0edb865 ]
KASAN reports a use-after-free:
BUG: KASAN: use-after-free in dvb_dmxdev_release+0x4d5/0x5d0 [dvb_core] Call Trace: ... dvb_dmxdev_release+0x4d5/0x5d0 [dvb_core] vidtv_bridge_probe+0x7bf/0xa40 [dvb_vidtv_bridge] platform_probe+0xb6/0x170 ... Allocated by task 1238: ... dvb_register_device+0x1a7/0xa70 [dvb_core] dvb_dmxdev_init+0x2af/0x4a0 [dvb_core] vidtv_bridge_probe+0x766/0xa40 [dvb_vidtv_bridge] ... Freed by task 1238: dvb_register_device+0x6d2/0xa70 [dvb_core] dvb_dmxdev_init+0x2af/0x4a0 [dvb_core] vidtv_bridge_probe+0x766/0xa40 [dvb_vidtv_bridge] ...
It is because the error handling in vidtv_bridge_dvb_init() is wrong.
First, vidtv_bridge_dmx(dev)_init() will clean themselves when fail, but goto fail_dmx(_dev): calls release functions again, which causes use-after-free.
Also, in fail_fe, fail_tuner_probe and fail_demod_probe, j = i will cause out-of-bound when i finished its loop (i == NUM_FE). And the loop releasing is wrong, although now NUM_FE is 1 so it won't cause problem.
Fix this by correctly releasing everything.
--- .../media/test-drivers/vidtv/vidtv_bridge.c | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-)
drivers/media/test-drivers/vidtv/vidtv_bridge.c +8 -14
@@ -459,26 +459,20 @@ static int vidtv_bridge_dvb_init(struct vidtv_dvb *dvb)for (j = j -1 ; j >=0 ; --j) dvb->demux.dmx.remove_frontend (&dvb->demux.dmx, &dvb->dmx_fe[j]); -fail_dmx_dev:dvb_dmxdev_release (&dvb->dmx_dev); -fail_dmx: +fail_dmx_dev:dvb_dmx_release (&dvb->demux); +fail_dmx: +fail_demod_probe: +for (i = i -1 ; i >=0 ; --i) { +dvb_unregister_frontend (dvb->fe[i]); fail_fe: -for (j = i; j >=0 ; --j) -dvb_unregister_frontend (dvb->fe[j]); +dvb_module_release (dvb->i2c_client_tuner[i]); fail_tuner_probe: -for (j = i; j >=0 ; --j) -if (dvb->i2c_client_tuner[j]) -dvb_module_release (dvb->i2c_client_tuner[j]); - -fail_demod_probe: -for (j = i; j >=0 ; --j) -if (dvb->i2c_client_demod[j]) -dvb_module_release (dvb->i2c_client_demod[j]); - +dvb_module_release (dvb->i2c_client_demod[i]); + } fail_adapter:dvb_unregister_adapter (&dvb->adapter); - fail_i2c:i2c_del_adapter (&dvb->i2c_adapter);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 355/1146 media: solo6x10: fix possible memory leak in solo_sysfs_init()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 7f5866dd96d95b74e439f6ee17b8abd8195179fb ]
If device_register() returns error in solo_sysfs_init(), the name allocated by dev_set_name() need be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanup().
--- drivers/media/pci/solo6x10/solo6x10-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/solo6x10/solo6x10-core.c +1 -0
@@ -420,6 +420,7 @@ static int solo_sysfs_init(struct solo_dev *solo_dev) solo_dev->nr_chans);if (device_register (dev)) { +put_device (dev); dev->parent =NULL ;return -ENOMEM ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 356/1146 media: platform: exynos4-is: Fix error handling in fimc_md_init()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit b434422c45282a0573d8123239abc41fa72665d4 ]
A problem about modprobe s5p_fimc failed is triggered with the following log given:
[ 272.075275] Error: Driver 'exynos4-fimc' is already registered, aborting... modprobe: ERROR: could not insert 's5p_fimc': Device or resource busy
The reason is that fimc_md_init() returns platform_driver_register() directly without checking its return value, if platform_driver_register() failed, it returns without unregister fimc_driver, resulting the s5p_fimc can never be installed later.
A simple call graph is shown as below:
fimc_md_init()
fimc_register_driver() # register fimc_driver
platform_driver_register()
platform_driver_register()
driver_register()
bus_add_driver()
dev = kzalloc(...) # OOM happened
# return without unregister fimc_driver
Fix by unregister fimc_driver when platform_driver_register() returns error.
--- drivers/media/platform/samsung/exynos4-is/fimc-core.c | 2 +- drivers/media/platform/samsung/exynos4-is/media-dev.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/media/platform/samsung/exynos4-is/fimc-core.c +1 -1
@@ -1173,7 +1173,7 @@ int __init fimc_register_driver(void)return platform_driver_register (&fimc_driver); } -void __exit fimc_unregister_driver(void) +void fimc_unregister_driver (void ) {platform_driver_unregister (&fimc_driver); }
drivers/media/platform/samsung/exynos4-is/media-dev.c +5 -1
@@ -1584,7 +1584,11 @@ static int __init fimc_md_init(void)if (ret)return ret; -return platform_driver_register (&fimc_md_driver); + ret =platform_driver_register (&fimc_md_driver); +if (ret) +fimc_unregister_driver (); + +return ret; } static void __exit fimc_md_exit(void)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 357/1146 media: amphion: Fix error handling in vpu_driver_init()
In reply to Greg Kroah-HartmanFrom: Yuan Can <[email protected]>
[ Upstream commit a95cc6d11aae16a7b2d043b073a40de81bbea689 ]
A problem about modprobe amphion-vpu failed is triggered with the following log given:
[ 2208.634841] Error: Driver 'amphion-vpu' is already registered, aborting... modprobe: ERROR: could not insert 'amphion_vpu': Device or resource busy
The reason is that vpu_driver_init() returns vpu_core_driver_init() directly without checking its return value, if vpu_core_driver_init() failed, it returns without unregister amphion_vpu_driver, resulting the amphion-vpu can never be installed later.
A simple call graph is shown as below:
vpu_driver_init()
platform_driver_register() # register amphion_vpu_driver vpu_core_driver_init()
platform_driver_register()
driver_register()
bus_add_driver()
dev = kzalloc(...) # OOM happened
# return without unregister amphion_vpu_driver
Fix by unregister amphion_vpu_driver when vpu_core_driver_init() returns error.
--- drivers/media/platform/amphion/vpu_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/amphion/vpu_drv.c +5 -1
@@ -245,7 +245,11 @@ static int __init vpu_driver_init(void)if (ret)return ret; -return vpu_core_driver_init (); + ret =vpu_core_driver_init (); +if (ret) +platform_driver_unregister (&hion_vpu_driver); + +return ret; } static void __exit vpu_driver_exit(void)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 358/1146 media: videobuf-dma-contig: use dma_mmap_coherent
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit b3dc3f8e49577840dc8ac8a365c5b3da4edb10b8 ]
dma_alloc_coherent does not return a physical address, but a DMA address, which might be remapped or have an offset. Passing the DMA address to vm_iomap_memory is thus broken.
Use the proper dma_mmap_coherent helper instead, and stop passing __GFP_COMP to dma_alloc_coherent, as the memory management inside the DMA allocator is hidden from the callers and does not require it.
With this the gfp_t argument to __videobuf_dc_alloc can be removed and hard coded to GFP_KERNEL.
--- drivers/media/v4l2-core/videobuf-dma-contig.c | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-)
drivers/media/v4l2-core/videobuf-dma-contig.c +8 -14
@@ -36,12 +36,11 @@ struct videobuf_dma_contig_memory {static int __videobuf_dc_alloc (struct device *dev,struct videobuf_dma_contig_memory *mem, -unsigned long size,gfp_t flags) +unsigned long size) { mem->size = size; - mem->vaddr =dma_alloc_coherent (dev, mem->size, - &mem->dma_handle, flags); - + mem->vaddr =dma_alloc_coherent (dev, mem->size, &mem->dma_handle, +GFP_KERNEL );if (!mem->vaddr) {dev_err (dev,"memory alloc size %ld failed\n" , mem->size);return -ENOMEM ;
@@ -258,8 +257,7 @@ static int __videobuf_iolock(struct videobuf_queue *q,return videobuf_dma_contig_user_get (mem, vb);/* allocate memory for the read() method */ -if (__videobuf_dc_alloc (q->dev, mem,PAGE_ALIGN (vb->size), -GFP_KERNEL )) +if (__videobuf_dc_alloc (q->dev, mem,PAGE_ALIGN (vb->size)))return -ENOMEM ;break ;case V4L2_MEMORY_OVERLAY :
@@ -295,22 +293,18 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,BUG_ON (!mem);MAGIC_CHECK (mem->magic,MAGIC_DC_MEM ); -if (__videobuf_dc_alloc (q->dev, mem,PAGE_ALIGN (buf->bsize), -GFP_KERNEL | __GFP_COMP)) +if (__videobuf_dc_alloc (q->dev, mem,PAGE_ALIGN (buf->bsize))) goto error; -/* Try to remap memory */ - vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); -/* the "vm_pgoff" is just used in v4l2 to find the * corresponding buffer data structure which is allocated * earlier and it does not mean the offset from the physical * buffer start address as usual. So set it to 0 to pass -* the sanity check in vm_iomap_memory(). +* the sanity check in dma_mmap_coherent(). */ vma->vm_pgoff =0 ; - - retval =vm_iomap_memory (vma, mem->dma_handle, mem->size); + retval =dma_mmap_coherent (q->dev, vma, mem->vaddr, mem->dma_handle, + mem->size);if (retval) {dev_err (q->dev,"mmap: remap failed with error %d. " , retval);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 359/1146 net: ethernet: mtk_eth_soc: fix RSTCTRL_PPE{0,1} definitions
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit ef8c373bd91df3cf70596497da0955d218961ead ]
Fix RSTCTRL_PPE0 and RSTCTRL_PPE1 register mask definitions for MTK_NETSYS_V2.
Remove duplicated definitions.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 13 +++++++------ drivers/net/ethernet/mediatek/mtk_eth_soc.h | 10 +++------- 2 files changed, 10 insertions(+), 13 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +7 -6
@@ -3292,16 +3292,17 @@ static int mtk_hw_init(struct mtk_eth *eth)return 0 ; } - val =RSTCTRL_FE |RSTCTRL_PPE ;if (MTK_HAS_CAPS (eth->soc->caps,MTK_NETSYS_V2 )) {regmap_write (eth->ethsys,ETHSYS_FE_RST_CHK_IDLE_EN ,0 ); - - val |=RSTCTRL_ETH ; -if (MTK_HAS_CAPS (eth->soc->caps,MTK_RSTCTRL_PPE1 )) - val |=RSTCTRL_PPE1 ; + val =RSTCTRL_PPE0_V2 ; + }else { + val =RSTCTRL_PPE0 ; } -ethsys_reset (eth, val); +if (MTK_HAS_CAPS (eth->soc->caps,MTK_RSTCTRL_PPE1 )) + val |=RSTCTRL_PPE1 ; + +ethsys_reset (eth,RSTCTRL_ETH |RSTCTRL_FE | val);if (MTK_HAS_CAPS (eth->soc->caps,MTK_NETSYS_V2 )) { regmap_write(eth->ethsys, ETHSYS_FE_RST_CHK_IDLE_EN,
drivers/net/ethernet/mediatek/mtk_eth_soc.h +3 -7
@@ -447,18 +447,14 @@/* ethernet reset control register */ #define ETHSYS_RSTCTRL 0x34#define RSTCTRL_FE BIT(6) -#define RSTCTRL_PPE BIT(31) -#define RSTCTRL_PPE1 BIT(30) +#define RSTCTRL_PPE0 BIT(31) +#define RSTCTRL_PPE0_V2 BIT(30) +#define RSTCTRL_PPE1 BIT(31)#define RSTCTRL_ETH BIT(23)/* ethernet reset check idle register */ #define ETHSYS_FE_RST_CHK_IDLE_EN 0x28 -/* ethernet reset control register */ -#define ETHSYS_RSTCTRL 0x34 -#define RSTCTRL_FE BIT(6) -#define RSTCTRL_PPE BIT(31) -/* ethernet dma channel agent map */ #define ETHSYS_DMA_AG_MAP 0x408#define ETHSYS_DMA_AG_MAP_PDMA BIT(0)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 360/1146 udp: Clean up some functions.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 919dfa0b20ae56060dce0436eb710717f8987d18 ]
This patch adds no functional change and cleans up some functions that the following patches touch around so that we make them tidy and easy to review/revert. The change is mainly to keep reverse christmas tree order.
Stable-dep-of: 7a7160edf1bf ("net: Return errno in sk->sk_prot->get_port().")
--- net/ipv4/udp.c | 39 +++++++++++++++++++++++---------------- net/ipv6/udp.c | 12 ++++++++---- 2 files changed, 31 insertions(+), 20 deletions(-)
net/ipv4/udp.c +23 -16
@@ -232,16 +232,16 @@ static int udp_reuseport_add_sock(struct sock *sk, struct udp_hslot *hslot)int udp_lib_get_port (struct sock *sk,unsigned short snum,unsigned int hash2_nulladdr) { -struct udp_hslot *hslot, *hslot2;struct udp_table *udptable = sk->sk_prot->h.udp_table; -int error =1 ; +struct udp_hslot *hslot, *hslot2;struct net *net =sock_net (sk); +int error =1 ;if (!snum) { +DECLARE_BITMAP (bitmap,PORTS_PER_CHAIN ); +unsigned short first, last;int low, high, remaining;unsigned int rand; -unsigned short first, last; -DECLARE_BITMAP (bitmap,PORTS_PER_CHAIN );inet_get_local_port_range (net, &low, &high); remaining = (high - low) +1 ;
@@ -2518,10 +2518,13 @@ static struct sock *__udp4_lib_mcast_demux_lookup(struct net *net, __be16 rmt_port, __be32 rmt_addr, int dif, int sdif) { - struct sock *sk, *result; unsigned short hnum = ntohs(loc_port); -unsigned int slot =udp_hashfn (net, hnum, udp_table.mask); -struct udp_hslot *hslot = &udp_table.hash[slot]; +struct sock *sk, *result; +struct udp_hslot *hslot; +unsigned int slot; + + slot =udp_hashfn (net, hnum, udp_table.mask); + hslot = &udp_table.hash[slot];/* Do not bother scanning a too big list */ if (hslot->count >10 )
@@ -2549,14 +2552,18 @@ static struct sock *__udp4_lib_demux_lookup(struct net *net, __be16 rmt_port, __be32 rmt_addr, int dif, int sdif) { - unsigned short hnum = ntohs(loc_port); -unsigned int hash2 =ipv4_portaddr_hash (net, loc_addr, hnum); -unsigned int slot2 = hash2 & udp_table.mask; -struct udp_hslot *hslot2 = &udp_table.hash2[slot2];INET_ADDR_COOKIE (acookie ,rmt_addr ,loc_addr ); -const __portpair ports =INET_COMBINED_PORTS (rmt_port, hnum); +unsigned short hnum =ntohs (loc_port); +unsigned int hash2, slot2; +struct udp_hslot *hslot2; +__portpair ports;struct sock *sk; + hash2 =ipv4_portaddr_hash (net, loc_addr, hnum); + slot2 = hash2 & udp_table.mask; + hslot2 = &udp_table.hash2[slot2]; + ports =INET_COMBINED_PORTS (rmt_port, hnum); +udp_portaddr_for_each_entry_rcu (sk, &hslot2->head) {if (inet_match (net, sk, acookie, ports, dif, sdif))return sk;
@@ -2957,10 +2964,10 @@ EXPORT_SYMBOL(udp_prot);static struct sock *udp_get_first (struct seq_file *seq,int start) { -struct sock *sk; -struct udp_seq_afinfo *afinfo;struct udp_iter_state *state = seq->private;struct net *net =seq_file_net (seq); +struct udp_seq_afinfo *afinfo; +struct sock *sk;if (state->bpf_seq_afinfo) afinfo = state->bpf_seq_afinfo;
@@ -2991,9 +2998,9 @@ static struct sock *udp_get_first(struct seq_file *seq, int start)static struct sock *udp_get_next (struct seq_file *seq,struct sock *sk) { -struct udp_seq_afinfo *afinfo;struct udp_iter_state *state = seq->private;struct net *net =seq_file_net (seq); +struct udp_seq_afinfo *afinfo;if (state->bpf_seq_afinfo) afinfo = state->bpf_seq_afinfo;
@@ -3049,8 +3056,8 @@ EXPORT_SYMBOL(udp_seq_next);void udp_seq_stop (struct seq_file *seq,void *v) { -struct udp_seq_afinfo *afinfo;struct udp_iter_state *state = seq->private; +struct udp_seq_afinfo *afinfo;if (state->bpf_seq_afinfo) afinfo = state->bpf_seq_afinfo;
net/ipv6/udp.c +8 -4
@@ -1063,12 +1063,16 @@ static struct sock *__udp6_lib_demux_lookup(struct net *net, int dif, int sdif) {unsigned short hnum =ntohs (loc_port); -unsigned int hash2 =ipv6_portaddr_hash (net, loc_addr, hnum); -unsigned int slot2 = hash2 & udp_table.mask; -struct udp_hslot *hslot2 = &udp_table.hash2[slot2]; -const __portpair ports =INET_COMBINED_PORTS (rmt_port, hnum); +unsigned int hash2, slot2; +struct udp_hslot *hslot2; +__portpair ports;struct sock *sk; + hash2 =ipv6_portaddr_hash (net, loc_addr, hnum); + slot2 = hash2 & udp_table.mask; + hslot2 = &udp_table.hash2[slot2]; + ports =INET_COMBINED_PORTS (rmt_port, hnum); +udp_portaddr_for_each_entry_rcu (sk, &hslot2->head) {if (sk->sk_state ==TCP_ESTABLISHED &&inet6_match (net, sk, rmt_addr, loc_addr, ports, dif, sdif))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 361/1146 net: Return errno in sk->sk_prot->get_port().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 7a7160edf1bfde25422262fb26851cef65f695d3 ]
We assume the correct errno is -EADDRINUSE when sk->sk_prot->get_port() fails, so some ->get_port() functions return just 1 on failure and the callers return -EADDRINUSE instead.
However, mptcp_get_port() can return -EINVAL. Let's not ignore the error.
Note the only exception is inet_autobind(), all of whose callers return -EAGAIN instead.
--- net/ipv4/af_inet.c | 4 ++-- net/ipv4/inet_connection_sock.c | 7 ++++--- net/ipv4/ping.c | 2 +- net/ipv4/udp.c | 2 +- net/ipv6/af_inet6.c | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-)
net/ipv4/af_inet.c +2 -2
@@ -522,9 +522,9 @@ int __inet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,/* Make sure we are allowed to bind here. */ if (snum || !(inet->bind_address_no_port || (flags &BIND_FORCE_ADDRESS_NO_PORT ))) { -if (sk->sk_prot->get_port (sk, snum)) { + err = sk->sk_prot->get_port (sk, snum); +if (err) { inet->inet_saddr = inet->inet_rcv_saddr =0 ; - err = -EADDRINUSE ; goto out_release_sock; }if (!(flags &BIND_FROM_BPF )) {
net/ipv4/inet_connection_sock.c +4 -3
@@ -471,11 +471,11 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)bool reuse = sk->sk_reuse && sk->sk_state !=TCP_LISTEN ;bool found_port = false, check_bind_conflict = true;bool bhash_created = false, bhash2_created = false; +int ret = -EADDRINUSE , port = snum, l3mdev;struct inet_bind_hashbucket *head, *head2;struct inet_bind2_bucket *tb2 =NULL ;struct inet_bind_bucket *tb =NULL ;bool head2_lock_acquired = false; -int ret =1 , port = snum, l3mdev;struct net *net =sock_net (sk); l3mdev =inet_sk_bound_l3mdev (sk);
@@ -1186,7 +1186,7 @@ int inet_csk_listen_start(struct sock *sk) {struct inet_connection_sock *icsk =inet_csk (sk);struct inet_sock *inet =inet_sk (sk); -int err = -EADDRINUSE ; +int err;reqsk_queue_alloc (&icsk->icsk_accept_queue);
@@ -1202,7 +1202,8 @@ int inet_csk_listen_start(struct sock *sk)* after validation is complete. */ inet_sk_state_store (sk,TCP_LISTEN ); -if (!sk->sk_prot->get_port (sk, inet->inet_num)) { + err = sk->sk_prot->get_port (sk, inet->inet_num); +if (!err) { inet->inet_sport =htons (inet->inet_num);sk_dst_reset (sk);
net/ipv4/ping.c +1 -1
@@ -143,7 +143,7 @@ int ping_get_port(struct sock *sk, unsigned short ident) fail:spin_unlock (&ping_table.lock); -return 1 ; +return -EADDRINUSE ; }EXPORT_SYMBOL_GPL (ping_get_port);
net/ipv4/udp.c +1 -1
@@ -235,7 +235,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,struct udp_table *udptable = sk->sk_prot->h.udp_table;struct udp_hslot *hslot, *hslot2;struct net *net =sock_net (sk); -int error =1 ; +int error = -EADDRINUSE ;if (!snum) {DECLARE_BITMAP (bitmap,PORTS_PER_CHAIN );
net/ipv6/af_inet6.c +2 -2
@@ -409,10 +409,10 @@ static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,/* Make sure we are allowed to bind here. */ if (snum || !(inet->bind_address_no_port || (flags &BIND_FORCE_ADDRESS_NO_PORT ))) { -if (sk->sk_prot->get_port (sk, snum)) { + err = sk->sk_prot->get_port (sk, snum); +if (err) { sk->sk_ipv6only = saved_ipv6only;inet_reset_saddr (sk); - err = -EADDRINUSE ; goto out; }if (!(flags &BIND_FROM_BPF )) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 362/1146 mtd: spi-nor: hide jedec_id sysfs attribute if not present
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 7d388551b6888f3725e6c957f472526b35161a5b ]
Some non-jedec compliant flashes (like the Everspin flashes) don't have an ID at all. Hide the attribute in this case.
--- .../ABI/testing/sysfs-bus-spi-devices-spi-nor | 3 +++ drivers/mtd/spi-nor/sysfs.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+)
Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor +3 -0
@@ -5,6 +5,9 @@ Contact: [email protected] Description: (RO) The JEDEC ID of the SPI NOR flash as reported by the flash device. + The attribute is not present if the flash doesn't support + the "Read JEDEC ID" command (9Fh). This is the case for + non-JEDEC compliant flashes. What: /sys/bus/spi/devices/.../spi-nor/manufacturer Date: April 2021
drivers/mtd/spi-nor/sysfs.c +14 -0
@@ -67,6 +67,19 @@ static struct bin_attribute *spi_nor_sysfs_bin_entries[] = { NULL }; +static umode_t spi_nor_sysfs_is_visible (struct kobject *kobj, +struct attribute *attr,int n) +{ +struct spi_device *spi =to_spi_device (kobj_to_dev (kobj)); +struct spi_mem *spimem =spi_get_drvdata (spi); +struct spi_nor *nor =spi_mem_get_drvdata (spimem); + +if (attr == &dev_attr_jedec_id.attr && !nor->info->id_len) +return 0 ; + +return 0444 ; +} +static umode_t spi_nor_sysfs_is_bin_visible (struct kobject *kobj,struct bin_attribute *attr,int n) {
@@ -82,6 +95,7 @@ static umode_t spi_nor_sysfs_is_bin_visible(struct kobject *kobj,static const struct attribute_group spi_nor_sysfs_group = { .name ="spi-nor" , + .is_visible = spi_nor_sysfs_is_visible, .is_bin_visible = spi_nor_sysfs_is_bin_visible, .attrs = spi_nor_sysfs_entries, .bin_attrs = spi_nor_sysfs_bin_entries,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 363/1146 mtd: spi-nor: Fix the number of bytes for the dummy cycles
In reply to Greg Kroah-HartmanFrom: Allen-KH Cheng <[email protected]>
[ Upstream commit fdc20370d93e8c6d2f448a539d08c2c064af7694 ]
The number of bytes used by spi_nor_spimem_check_readop() may be incorrect for the dummy cycles. Since nor->read_dummy is not initialized before spi_nor_spimem_adjust_hwcaps().
We use both mode and wait state clock cycles instead of nor->read_dummy.
--- drivers/mtd/spi-nor/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/core.c +2 -1
@@ -1914,7 +1914,8 @@ static int spi_nor_spimem_check_readop(struct spi_nor *nor,spi_nor_spimem_setup_op (nor, &op, read->proto);/* convert the dummy cycles to the number of bytes */ - op.dummy.nbytes = (nor->read_dummy * op.dummy.buswidth) /8 ; + op.dummy.nbytes = (read->num_mode_clocks + read->num_wait_states) * + op.dummy.buswidth /8 ;if (spi_nor_protocol_is_dtr (nor->read_proto)) op.dummy.nbytes *=2 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 364/1146 clk: imx93: correct the flexspi1 clock setting
In reply to Greg Kroah-HartmanFrom: Haibo Chen <[email protected]>
[ Upstream commit 62dfdbcc16e767b91ed35d4fc0428c86d4688505 ]
Correct IMX93_CLK_FLEXSPI1_GATE CCGR setting. Otherwise the flexspi always can't be assigned to a parent clock when dump the clock tree.
--- drivers/clk/imx/clk-imx93.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx93.c +1 -1
@@ -170,7 +170,7 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_MU2_B_GATE, "mu2_b", "bus_wakeup_root", 0x8500, 0, &share_count_mub }, { IMX93_CLK_EDMA1_GATE, "edma1", "m33_root", 0x8540, }, { IMX93_CLK_EDMA2_GATE, "edma2", "wakeup_axi_root", 0x8580, }, - { IMX93_CLK_FLEXSPI1_GATE, "flexspi", "flexspi_root", 0x8640, }, + { IMX93_CLK_FLEXSPI1_GATE, "flexspi1", "flexspi1_root", 0x8640, }, { IMX93_CLK_GPIO1_GATE, "gpio1", "m33_root", 0x8880, }, { IMX93_CLK_GPIO2_GATE, "gpio2", "bus_wakeup_root", 0x88c0, }, { IMX93_CLK_GPIO3_GATE, "gpio3", "bus_wakeup_root", 0x8900, },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 365/1146 bpf: Pin the start cgroup in cgroup_iter_seq_init()
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit 1a5160d4d8fe63ba4964cfff4a85831b6af75f2d ]
bpf_iter_attach_cgroup() has already acquired an extra reference for the start cgroup, but the reference may be released if the iterator link fd is closed after the creation of iterator fd, and it may lead to user-after-free problem when reading the iterator fd.
An alternative fix is pinning iterator link when opening iterator, but it will make iterator link being still visible after the close of iterator link fd and the behavior is different with other link types, so just fixing it by acquiring another reference for the start cgroup.
--- kernel/bpf/cgroup_iter.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
kernel/bpf/cgroup_iter.c +14 -0
@@ -164,16 +164,30 @@ static int cgroup_iter_seq_init(void *priv, struct bpf_iter_aux_info *aux)struct cgroup_iter_priv *p = (struct cgroup_iter_priv *)priv;struct cgroup *cgrp = aux->cgroup.start; +/* bpf_iter_attach_cgroup() has already acquired an extra reference +* for the start cgroup, but the reference may be released after +* cgroup_iter_seq_init(), so acquire another reference for the +* start cgroup. +*/ p->start_css = &cgrp->self; +css_get (p->start_css); p->terminate = false; p->visited_all = false; p->order = aux->cgroup.order;return 0 ; } +static void cgroup_iter_seq_fini (void *priv) +{ +struct cgroup_iter_priv *p = (struct cgroup_iter_priv *)priv; + +css_put (p->start_css); +} +static const struct bpf_iter_seq_info cgroup_iter_seq_info = { .seq_ops = &cgroup_iter_seq_ops, .init_seq_private = cgroup_iter_seq_init, + .fini_seq_private = cgroup_iter_seq_fini, .seq_priv_size =sizeof (struct cgroup_iter_priv ), };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 366/1146 HID: i2c: let RMI devices decide what constitutes wakeup event
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 9984fbf55b9bd998b4ff66395cbb118020c1effa ]
HID-RMI is special in the sense that it does not carry HID events directly, but rather uses HID protocol as a wrapper/transport for RMI protocol. Therefore we should not assume that all data coming from the device via interrupt is associated with user activity and report wakeup event indiscriminately, but rather let HID-RMI do that when appropriate.
HID-RMI devices tag responses to the commands issued by the host as RMI_READ_DATA_REPORT_ID whereas motion and other input events from the device are tagged as RMI_ATTN_REPORT_ID. Change hid-rmi to report wakeup events when receiving the latter packets. This allows ChromeOS to accurately identify wakeup source and make correct decision on the mode of the resume the system should take ("dark" where the display stays off vs normal one).
--- drivers/hid/hid-rmi.c | 2 ++ drivers/hid/i2c-hid/i2c-hid-core.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-rmi.c +2 -0
@@ -326,6 +326,8 @@ static int rmi_input_event(struct hid_device *hdev, u8 *data, int size)if (!(test_bit (RMI_STARTED , &hdata->flags)))return 0 ; +pm_wakeup_event (hdev->dev.parent,0 ); +local_irq_save (flags);rmi_set_attn_data (rmi_dev, data[1 ], &data[2 ], size -2 );
drivers/hid/i2c-hid/i2c-hid-core.c +2 -1
@@ -554,7 +554,8 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)i2c_hid_dbg (ihid,"input: %*ph\n" , ret_size, ihid->inbuf);if (test_bit (I2C_HID_STARTED , &ihid->flags)) { -pm_wakeup_event (&ihid->client->dev,0 ); +if (ihid->hid->group !=HID_GROUP_RMI ) +pm_wakeup_event (&ihid->client->dev,0 ); hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + sizeof(__le16),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 367/1146 clk: imx93: unmap anatop base in error handling path
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit bda7b7f396f94d8df89ecacc88f2826908e8762c ]
The anatop base is not unmapped during error handling path, fix it.
--- drivers/clk/imx/clk-imx93.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/clk/imx/clk-imx93.c +9 -6
@@ -258,7 +258,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)struct device_node *np = dev->of_node;const struct imx93_clk_root *root;const struct imx93_clk_ccgr *ccgr; -void __iomem *base =NULL ; +void __iomem *base, *anatop_base;int i, ret; clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
@@ -285,20 +285,22 @@ static int imx93_clocks_probe(struct platform_device *pdev) "sys_pll_pfd2", 1, 2); np =of_find_compatible_node (NULL ,NULL ,"fsl,imx93-anatop" ); - base =of_iomap (np,0 ); + anatop_base =of_iomap (np,0 );of_node_put (np); -if (WARN_ON (!base)) +if (WARN_ON (!anatop_base))return -ENOMEM ; - clks[IMX93_CLK_AUDIO_PLL ] =imx_clk_fracn_gppll ("audio_pll" ,"osc_24m" , base +0x1200 , + clks[IMX93_CLK_AUDIO_PLL ] =imx_clk_fracn_gppll ("audio_pll" ,"osc_24m" , anatop_base +0x1200 , &imx_fracn_gppll); - clks[IMX93_CLK_VIDEO_PLL ] =imx_clk_fracn_gppll ("video_pll" ,"osc_24m" , base +0x1400 , + clks[IMX93_CLK_VIDEO_PLL ] =imx_clk_fracn_gppll ("video_pll" ,"osc_24m" , anatop_base +0x1400 , &imx_fracn_gppll); np = dev->of_node; base =devm_platform_ioremap_resource (pdev,0 ); -if (WARN_ON (IS_ERR (base))) +if (WARN_ON (IS_ERR (base))) { +iounmap (anatop_base);return PTR_ERR (base); + }for (i =0 ; i <ARRAY_SIZE (root_array); i++) { root = &root_array[i];
@@ -327,6 +329,7 @@ static int imx93_clocks_probe(struct platform_device *pdev) unregister_hws:imx_unregister_hw_clocks (clks,IMX93_CLK_END ); +iounmap (anatop_base);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 368/1146 clk: imx93: correct enet clock
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit 4be5d91b9433f1dc76de485e240ca6aaa2d19f65 ]
Per update Reference Mannual, correct the enet clock parent to wakeup_axi_root.
--- drivers/clk/imx/clk-imx93.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx93.c +1 -1
@@ -240,7 +240,7 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_AUD_XCVR_GATE, "aud_xcvr", "audio_xcvr_root", 0x9b80, }, { IMX93_CLK_SPDIF_GATE, "spdif", "spdif_root", 0x9c00, }, { IMX93_CLK_HSIO_32K_GATE, "hsio_32k", "osc_32k", 0x9dc0, }, - { IMX93_CLK_ENET1_GATE, "enet1", "enet_root", 0x9e00, }, + { IMX93_CLK_ENET1_GATE, "enet1", "wakeup_axi_root", 0x9e00, }, { IMX93_CLK_ENET_QOS_GATE, "enet_qos", "wakeup_axi_root", 0x9e40, }, { IMX93_CLK_SYS_CNT_GATE, "sys_cnt", "osc_24m", 0x9e80, }, { IMX93_CLK_TSTMR1_GATE, "tstmr1", "bus_aon_root", 0x9ec0, },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 369/1146 bpf: Move skb->len == 0 checks into __bpf_redirect
In reply to Greg Kroah-HartmanFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 114039b342014680911c35bd6b72624180fd669a ]
To avoid potentially breaking existing users.
Both mac/no-mac cases have to be amended; mac_header >= network_header is not enough (verified with a new test, see next patch).
--- net/bpf/test_run.c | 3 --- net/core/filter.c | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-)
net/bpf/test_run.c +0 -3
@@ -980,9 +980,6 @@ static int convert___skb_to_skb(struct sk_buff *skb, struct __sk_buff *__skb) {struct qdisc_skb_cb *cb = (struct qdisc_skb_cb *)skb->cb; -if (!skb->len) -return -EINVAL ; -if (!__skb)return 0 ;
net/core/filter.c +6 -1
@@ -2124,6 +2124,11 @@ static int __bpf_redirect_no_mac(struct sk_buff *skb, struct net_device *dev, {unsigned int mlen =skb_network_offset (skb); +if (unlikely (skb->len <= mlen)) { +kfree_skb (skb); +return -ERANGE ; + } +if (mlen) {__skb_pull (skb, mlen);
@@ -2145,7 +2150,7 @@ static int __bpf_redirect_common(struct sk_buff *skb, struct net_device *dev, u32 flags) {/* Verify that a link layer header is carried */ -if (unlikely (skb->mac_header >= skb->network_header)) { +if (unlikely (skb->mac_header >= skb->network_header || skb->len ==0 )) {kfree_skb (skb);return -ERANGE ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 370/1146 HID: hid-sensor-custom: set fixed size for custom attributes
In reply to Greg Kroah-HartmanFrom: Marcus Folkesson <[email protected]>
[ Upstream commit 9d013910df22de91333a0acc81d1dbb115bd76f6 ]
This is no bugfix (so no Fixes: tag is necessary) as it is taken care of in hid_sensor_custom_add_attributes().
The motivation for this patch is that:
hid_sensor_custom_field.attr_name and hid_sensor_custom_field.attrs
has the size of HID_CUSTOM_TOTAL_ATTRS and used in same context.
We compare against HID_CUSTOM_TOTAL_ATTRS when
looping through hid_custom_attrs.
We will silent the smatch error:hid_sensor_custom_add_attributes() error: buffer overflow 'hid_custom_attrs' 8 <= 10
--- drivers/hid/hid-sensor-custom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-sensor-custom.c +1 -1
@@ -62,7 +62,7 @@ struct hid_sensor_sample {u32 raw_len; } __packed; -static struct attribute hid_custom_attrs[] = { +static struct attribute hid_custom_attrs[HID_CUSTOM_TOTAL_ATTRS ] = { {.name ="name" , .mode =S_IRUGO }, {.name ="units" , .mode =S_IRUGO }, {.name ="unit-expo" , .mode =S_IRUGO },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 371/1146 clk: imx: imxrt1050: fix IMXRT1050_CLK_LCDIF_APB offsets
In reply to Greg Kroah-HartmanFrom: Giulio Benetti <[email protected]>
[ Upstream commit 3095c02f95e537c553e0b30948c2f6c7cbed87ee ]
Fix IMXRT1050_CLK_LCDIF_APB offsets.
--- drivers/clk/imx/clk-imxrt1050.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imxrt1050.c +1 -1
@@ -140,7 +140,7 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev) hws[IMXRT1050_CLK_USDHC1 ] =imx_clk_hw_gate2 ("usdhc1" ,"usdhc1_podf" , ccm_base +0x80 ,2 ); hws[IMXRT1050_CLK_USDHC2 ] =imx_clk_hw_gate2 ("usdhc2" ,"usdhc2_podf" , ccm_base +0x80 ,4 ); hws[IMXRT1050_CLK_LPUART1 ] =imx_clk_hw_gate2 ("lpuart1" ,"lpuart_podf" , ccm_base +0x7c ,24 ); - hws[IMXRT1050_CLK_LCDIF_APB ] =imx_clk_hw_gate2 ("lcdif" ,"lcdif_podf" , ccm_base +0x74 ,10 ); + hws[IMXRT1050_CLK_LCDIF_APB ] =imx_clk_hw_gate2 ("lcdif" ,"lcdif_podf" , ccm_base +0x70 ,28 ); hws[IMXRT1050_CLK_DMA ] =imx_clk_hw_gate ("dma" ,"ipg" , ccm_base +0x7C ,6 ); hws[IMXRT1050_CLK_DMA_MUX ] =imx_clk_hw_gate ("dmamux0" ,"ipg" , ccm_base +0x7C ,7 );imx_check_clk_hws (hws,IMXRT1050_CLK_END );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 372/1146 pinctrl: k210: call of_node_put()
In reply to Greg Kroah-HartmanFrom: ZhangPeng <[email protected]>
[ Upstream commit a8acc11643082a706de86a19f1f824712d971984 ]
Since for_each_available_child_of_node() will increase the refcount of node, we need to call of_node_put() manually when breaking out of the iteration.
--- drivers/pinctrl/pinctrl-k210.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-k210.c +3 -1
@@ -862,8 +862,10 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,for_each_available_child_of_node (np_config, np) { ret =k210_pinctrl_dt_subnode_to_map (pctldev, np, map, &reserved_maps, num_maps); -if (ret <0 ) +if (ret <0 ) { +of_node_put (np); goto err; + } }return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 373/1146 wifi: rtw89: fix physts IE page check
In reply to Greg Kroah-HartmanFrom: Zong-Zhe Yang <[email protected]>
[ Upstream commit 9e2f177de1bfb7d891bf38140bda54831ecef30d ]
The index RTW89_PHYSTS_BITMAP_NUM is not a valid physts IE page. So, fix the check condition.
--- drivers/net/wireless/realtek/rtw89/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/phy.c +1 -1
@@ -3139,7 +3139,7 @@ void rtw89_phy_env_monitor_track(struct rtw89_dev *rtwdev)static bool rtw89_physts_ie_page_valid (enum rtw89_phy_status_bitmap *ie_page) { -if (*ie_page >RTW89_PHYSTS_BITMAP_NUM || +if (*ie_page >=RTW89_PHYSTS_BITMAP_NUM || *ie_page ==RTW89_RSVD_9 )return false;else if (*ie_page >RTW89_RSVD_9 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 374/1146 ASoC: Intel: Skylake: Fix Kconfig dependency
In reply to Greg Kroah-HartmanFrom: Lili Li <[email protected]>
[ Upstream commit e5d4d2b23aed20a7815d1b500dbcd50af1da0023 ]
Commit e4746d94d00c ("ASoC: Intel: Skylake: Introduce HDA codec init and
exit routines") introduced HDA codec init routine which depends on SND_HDA. Select SND_SOC_HDAC_HDA unconditionally to fix following compile error:
ERROR: modpost: "snd_hda_codec_device_init" [sound/soc/intel/skylake/snd-soc-skl.ko] undefined!
--- sound/soc/intel/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/Kconfig +1 -1
@@ -177,7 +177,7 @@ config SND_SOC_INTEL_SKYLAKE_COMMON select SND_HDA_DSP_LOADER select SND_SOC_TOPOLOGY select SND_SOC_INTEL_SST - select SND_SOC_HDAC_HDA if SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC + select SND_SOC_HDAC_HDA select SND_SOC_ACPI_INTEL_MATCH select SND_INTEL_DSP_CONFIG help
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 375/1146 ASoC: Intel: avs: Lock substream before snd_pcm_stop()
In reply to Greg Kroah-HartmanFrom: Cezary Rojewski <[email protected]>
[ Upstream commit c30c8f9d51ec24b36e2c65a6307a5c8cbc5a0ebc ]
snd_pcm_stop() shall be called with stream lock held to prevent any races between nonatomic streaming operations.
--- sound/soc/intel/avs/ipc.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/intel/avs/ipc.c +3 -0
@@ -123,7 +123,10 @@ static void avs_dsp_recovery(struct avs_dev *adev)if (!substream || !substream->runtime)continue ; +/* No need for _irq() as we are in nonatomic context. */ +snd_pcm_stream_lock (substream);snd_pcm_stop (substream,SNDRV_PCM_STATE_DISCONNECTED ); +snd_pcm_stream_unlock (substream); } } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 376/1146 ALSA: pcm: fix undefined behavior in bit shift for SNDRV_PCM_RATE_KNOT
In reply to Greg Kroah-HartmanFrom: Baisong Zhong <[email protected]>
[ Upstream commit b5172e62458f8e6ff359e5f096044a488db90ac5 ]
Shifting signed 32-bit value by 31 bits is undefined, so changing significant bit to unsigned. The UBSAN warning calltrace like below:
UBSAN: shift-out-of-bounds in sound/core/pcm_native.c:2676:21 left shift of 1 by 31 places cannot be represented in type 'int' ... Call Trace: <TASK> dump_stack_lvl+0x8d/0xcf ubsan_epilogue+0xa/0x44 __ubsan_handle_shift_out_of_bounds+0x1e7/0x208 snd_pcm_open_substream+0x9f0/0xa90 snd_pcm_oss_open.part.26+0x313/0x670 snd_pcm_oss_open+0x30/0x40 soundcore_open+0x18b/0x2e0 chrdev_open+0xe2/0x270 do_dentry_open+0x2f7/0x620 path_openat+0xd66/0xe70 do_filp_open+0xe3/0x170 do_sys_openat2+0x357/0x4a0 do_sys_open+0x87/0xd0 do_syscall_64+0x34/0x80
--- include/sound/pcm.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
include/sound/pcm.h +18 -18
@@ -106,24 +106,24 @@ struct snd_pcm_ops {#define SNDRV_PCM_POS_XRUN ((snd_pcm_uframes_t)-1)/* If you change this don't forget to change rates[] table in pcm_native.c */ -#define SNDRV_PCM_RATE_5512 (1<<0)/* 5512Hz */ -#define SNDRV_PCM_RATE_8000 (1<<1)/* 8000Hz */ -#define SNDRV_PCM_RATE_11025 (1<<2)/* 11025Hz */ -#define SNDRV_PCM_RATE_16000 (1<<3)/* 16000Hz */ -#define SNDRV_PCM_RATE_22050 (1<<4)/* 22050Hz */ -#define SNDRV_PCM_RATE_32000 (1<<5)/* 32000Hz */ -#define SNDRV_PCM_RATE_44100 (1<<6)/* 44100Hz */ -#define SNDRV_PCM_RATE_48000 (1<<7)/* 48000Hz */ -#define SNDRV_PCM_RATE_64000 (1<<8)/* 64000Hz */ -#define SNDRV_PCM_RATE_88200 (1<<9)/* 88200Hz */ -#define SNDRV_PCM_RATE_96000 (1<<10)/* 96000Hz */ -#define SNDRV_PCM_RATE_176400 (1<<11)/* 176400Hz */ -#define SNDRV_PCM_RATE_192000 (1<<12)/* 192000Hz */ -#define SNDRV_PCM_RATE_352800 (1<<13)/* 352800Hz */ -#define SNDRV_PCM_RATE_384000 (1<<14)/* 384000Hz */ - -#define SNDRV_PCM_RATE_CONTINUOUS (1<<30)/* continuous range */ -#define SNDRV_PCM_RATE_KNOT (1<<31)/* supports more non-continuos rates */ +#define SNDRV_PCM_RATE_5512 (1U<<0)/* 5512Hz */ +#define SNDRV_PCM_RATE_8000 (1U<<1)/* 8000Hz */ +#define SNDRV_PCM_RATE_11025 (1U<<2)/* 11025Hz */ +#define SNDRV_PCM_RATE_16000 (1U<<3)/* 16000Hz */ +#define SNDRV_PCM_RATE_22050 (1U<<4)/* 22050Hz */ +#define SNDRV_PCM_RATE_32000 (1U<<5)/* 32000Hz */ +#define SNDRV_PCM_RATE_44100 (1U<<6)/* 44100Hz */ +#define SNDRV_PCM_RATE_48000 (1U<<7)/* 48000Hz */ +#define SNDRV_PCM_RATE_64000 (1U<<8)/* 64000Hz */ +#define SNDRV_PCM_RATE_88200 (1U<<9)/* 88200Hz */ +#define SNDRV_PCM_RATE_96000 (1U<<10)/* 96000Hz */ +#define SNDRV_PCM_RATE_176400 (1U<<11)/* 176400Hz */ +#define SNDRV_PCM_RATE_192000 (1U<<12)/* 192000Hz */ +#define SNDRV_PCM_RATE_352800 (1U<<13)/* 352800Hz */ +#define SNDRV_PCM_RATE_384000 (1U<<14)/* 384000Hz */ + +#define SNDRV_PCM_RATE_CONTINUOUS (1U<<30)/* continuous range */ +#define SNDRV_PCM_RATE_KNOT (1U<<31)/* supports more non-continuos rates */ #define SNDRV_PCM_RATE_8000_44100 (SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_11025|\ SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_22050|\
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 377/1146 ALSA: seq: fix undefined behavior in bit shift for SNDRV_SEQ_FILTER_USE_EVENT
In reply to Greg Kroah-HartmanFrom: Baisong Zhong <[email protected]>
[ Upstream commit cf59e1e4c79bf741905484cdb13c130b53576a16 ]
Shifting signed 32-bit value by 31 bits is undefined, so changing significant bit to unsigned. The UBSAN warning calltrace like below:
UBSAN: shift-out-of-bounds in sound/core/seq/seq_clientmgr.c:509:22 left shift of 1 by 31 places cannot be represented in type 'int' ... Call Trace: <TASK> dump_stack_lvl+0x8d/0xcf ubsan_epilogue+0xa/0x44 __ubsan_handle_shift_out_of_bounds+0x1e7/0x208 snd_seq_deliver_single_event.constprop.21+0x191/0x2f0 snd_seq_deliver_event+0x1a2/0x350 snd_seq_kernel_client_dispatch+0x8b/0xb0 snd_seq_client_notify_subscription+0x72/0xa0 snd_seq_ioctl_subscribe_port+0x128/0x160 snd_seq_kernel_client_ctl+0xce/0xf0 snd_seq_oss_create_client+0x109/0x15b alsa_seq_oss_init+0x11c/0x1aa do_one_initcall+0x80/0x440 kernel_init_freeable+0x370/0x3c3 kernel_init+0x1b/0x190 ret_from_fork+0x1f/0x30 </TASK>
--- include/uapi/sound/asequencer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/uapi/sound/asequencer.h +4 -4
@@ -328,10 +328,10 @@ typedef int __bitwise snd_seq_client_type_t;#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)/* event filter flags */ -#define SNDRV_SEQ_FILTER_BROADCAST (1<<0)/* accept broadcast messages */ -#define SNDRV_SEQ_FILTER_MULTICAST (1<<1)/* accept multicast messages */ -#define SNDRV_SEQ_FILTER_BOUNCE (1<<2)/* accept bounce event in error */ -#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31)/* use event filter */ +#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0)/* accept broadcast messages */ +#define SNDRV_SEQ_FILTER_MULTICAST (1U<<1)/* accept multicast messages */ +#define SNDRV_SEQ_FILTER_BOUNCE (1U<<2)/* accept bounce event in error */ +#define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31)/* use event filter */ struct snd_seq_client_info {int client;/* client number to inquire */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 378/1146 regulator: core: use kfree_const() to free space conditionally
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit dc8d006d15b623c1d80b90b45d6dcb6e890dad09 ]
Use kfree_const() to free supply_name conditionally in create_regulator() as supply_name may be allocated from kmalloc() or directly from .rodata section.
--- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
@@ -1813,7 +1813,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, regulator =kzalloc (sizeof (*regulator),GFP_KERNEL );if (regulator ==NULL ) { -kfree (supply_name); +kfree_const (supply_name);return NULL ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 379/1146 clk: rockchip: Fix memory leak in rockchip_clk_register_pll()
In reply to Greg Kroah-HartmanFrom: Xiu Jianfeng <[email protected]>
[ Upstream commit 739a6a6bbdb793bd57938cb24aa5a6df89983546 ]
If clk_register() fails, @pll->rate_table may have allocated memory by kmemdup(), so it needs to be freed, otherwise will cause memory leak issue, this patch fixes it.
--- drivers/clk/rockchip/clk-pll.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/rockchip/clk-pll.c +1 -0
@@ -981,6 +981,7 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,return mux_clk; err_pll: +kfree (pll->rate_table);clk_unregister (mux_clk); mux_clk = pll_clk; err_mux:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 380/1146 drm/amdgpu: fix pci device refcount leak
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit b85e285e3d6352b02947fc1b72303673dfacb0aa ]
As comment of pci_get_domain_bus_and_slot() says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by calling pci_dev_put().
So before returning from amdgpu_device_resume|suspend_display_audio(), pci_dev_put() is called to avoid refcount leak.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
@@ -5027,6 +5027,8 @@ static void amdgpu_device_resume_display_audio(struct amdgpu_device *adev)pm_runtime_enable (&(p->dev));pm_runtime_resume (&(p->dev)); } + +pci_dev_put (p); }static int amdgpu_device_suspend_display_audio (struct amdgpu_device *adev)
@@ -5065,6 +5067,7 @@ static int amdgpu_device_suspend_display_audio(struct amdgpu_device *adev)if (expires <ktime_get_mono_fast_ns ()) {dev_warn (adev->dev,"failed to suspend display audio\n" ); +pci_dev_put (p);/* TODO: abort the succeeding gpu reset? */ return -ETIMEDOUT ; }
@@ -5072,6 +5075,7 @@ static int amdgpu_device_suspend_display_audio(struct amdgpu_device *adev)pm_runtime_disable (&(p->dev)); +pci_dev_put (p);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 381/1146 drm/i915/guc: make default_lists const data
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
[ Upstream commit dfa5e6ef3ccefff9fa8a70d9f5fa6ef6244aa312 ]
The default_lists array should be in rodata.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c +1 -1
@@ -165,7 +165,7 @@ static const struct __guc_mmio_reg_descr empty_regs_list[] = { }/* List of lists */ -static struct __guc_mmio_reg_descr_group default_lists[] = { +static const struct __guc_mmio_reg_descr_group default_lists[] = {MAKE_REGLIST (default_global_regs,PF ,GLOBAL ,0 ),MAKE_REGLIST (default_rc_class_regs,PF ,ENGINE_CLASS ,GUC_RENDER_CLASS ),MAKE_REGLIST (xe_lpd_rc_inst_regs,PF ,ENGINE_INSTANCE ,GUC_RENDER_CLASS ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 382/1146 selftests/bpf: Make sure zero-len skbs arent redirectable
In reply to Greg Kroah-HartmanFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 68f8e3d4b916531ea3bb8b83e35138cf78f2fce5 ]
LWT_XMIT to test L3 case, TC to test L2 case.
v2:
- s/veth_ifindex/ipip_ifindex/ in two places (Martin)
- add comment about which condition triggers the rejection (Martin)
Stable-dep-of: 8ac88eece800 ("selftests/bpf: Mount debugfs in setns_by_fd")
--- .../selftests/bpf/prog_tests/empty_skb.c | 146 ++++++++++++++++++ tools/testing/selftests/bpf/progs/empty_skb.c | 37 +++++ 2 files changed, 183 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/empty_skb.c create mode 100644 tools/testing/selftests/bpf/progs/empty_skb.c
tools/testing/selftests/bpf/prog_tests/empty_skb.c new file +146 -0
@@ -0,0 +1,146 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <test_progs.h> +#include <network_helpers.h> +#include <net/if.h> +#include "empty_skb.skel.h" + +#define SYS (cmd) ({ \ + if (!ASSERT_OK(system(cmd), (cmd))) \ + goto out; \ +}) + +void test_empty_skb (void ) +{ +LIBBPF_OPTS (bpf_test_run_opts, tattr); +struct empty_skb *bpf_obj =NULL ; +struct nstoken *tok =NULL ; +struct bpf_program *prog; +char eth_hlen_pp[15 ]; +char eth_hlen[14 ]; +int veth_ifindex; +int ipip_ifindex; +int err; +int i; + +struct { +const char *msg; +const void *data_in; +__u32 data_size_in; +int *ifindex; +int err; +int ret; +bool success_on_tc; + } tests[] = { +/* Empty packets are always rejected. */ + + { +/* BPF_PROG_RUN ETH_HLEN size check */ + .msg ="veth empty ingress packet" , + .data_in =NULL , + .data_size_in =0 , + .ifindex = &veth_ifindex, + .err = -EINVAL , + }, + { +/* BPF_PROG_RUN ETH_HLEN size check */ + .msg ="ipip empty ingress packet" , + .data_in =NULL , + .data_size_in =0 , + .ifindex = &ipip_ifindex, + .err = -EINVAL , + }, + +/* ETH_HLEN-sized packets: +* - can not be redirected at LWT_XMIT +* - can be redirected at TC to non-tunneling dest +*/ + + { +/* __bpf_redirect_common */ + .msg ="veth ETH_HLEN packet ingress" , + .data_in = eth_hlen, + .data_size_in =sizeof (eth_hlen), + .ifindex = &veth_ifindex, + .ret = -ERANGE , + .success_on_tc = true, + }, + { +/* __bpf_redirect_no_mac +* +* lwt: skb->len=0 <= skb_network_offset=0 +* tc: skb->len=14 <= skb_network_offset=14 +*/ + .msg ="ipip ETH_HLEN packet ingress" , + .data_in = eth_hlen, + .data_size_in =sizeof (eth_hlen), + .ifindex = &ipip_ifindex, + .ret = -ERANGE , + }, + +/* ETH_HLEN+1-sized packet should be redirected. */ + + { + .msg ="veth ETH_HLEN+1 packet ingress" , + .data_in = eth_hlen_pp, + .data_size_in =sizeof (eth_hlen_pp), + .ifindex = &veth_ifindex, + }, + { + .msg ="ipip ETH_HLEN+1 packet ingress" , + .data_in = eth_hlen_pp, + .data_size_in =sizeof (eth_hlen_pp), + .ifindex = &ipip_ifindex, + }, + }; + +SYS ("ip netns add empty_skb" ); + tok =open_netns ("empty_skb" ); +SYS ("ip link add veth0 type veth peer veth1" ); +SYS ("ip link set dev veth0 up" ); +SYS ("ip link set dev veth1 up" ); +SYS ("ip addr add 10.0.0.1/8 dev veth0" ); +SYS ("ip addr add 10.0.0.2/8 dev veth1" ); + veth_ifindex =if_nametoindex ("veth0" ); + +SYS ("ip link add ipip0 type ipip local 10.0.0.1 remote 10.0.0.2" ); +SYS ("ip link set ipip0 up" ); +SYS ("ip addr add 192.168.1.1/16 dev ipip0" ); + ipip_ifindex =if_nametoindex ("ipip0" ); + + bpf_obj =empty_skb__open_and_load (); +if (!ASSERT_OK_PTR (bpf_obj,"open skeleton" )) + goto out; + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +bpf_object__for_each_program (prog, bpf_obj->obj) { +char buf[128 ]; +bool at_tc = !strncmp (bpf_program__section_name (prog),"tc" ,2 ); + + tattr.data_in = tests[i].data_in; + tattr.data_size_in = tests[i].data_size_in; + + tattr.data_size_out =0 ; + bpf_obj->bss->ifindex = *tests[i].ifindex; + bpf_obj->bss->ret =0 ; + err =bpf_prog_test_run_opts (bpf_program__fd (prog), &tattr); +sprintf (buf,"err: %s [%s]" , tests[i].msg,bpf_program__name (prog)); + +if (at_tc && tests[i].success_on_tc) +ASSERT_GE (err,0 , buf); +else +ASSERT_EQ (err, tests[i].err, buf); +sprintf (buf,"ret: %s [%s]" , tests[i].msg,bpf_program__name (prog)); +if (at_tc && tests[i].success_on_tc) +ASSERT_GE (bpf_obj->bss->ret,0 , buf); +else +ASSERT_EQ (bpf_obj->bss->ret, tests[i].ret, buf); + } + } + +out: +if (bpf_obj) +empty_skb__destroy (bpf_obj); +if (tok) +close_netns (tok); +system ("ip netns del empty_skb" ); +}
tools/testing/selftests/bpf/progs/empty_skb.c new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +#include <linux/bpf.h> +#include <bpf/bpf_helpers.h> +#include <bpf/bpf_endian.h> + +char _license[] SEC("license") = "GPL"; + +int ifindex; +int ret; + +SEC("lwt_xmit") +int redirect_ingress (struct __sk_buff *skb) +{ + ret =bpf_clone_redirect (skb, ifindex,BPF_F_INGRESS ); +return 0 ; +} + +SEC("lwt_xmit") +int redirect_egress (struct __sk_buff *skb) +{ + ret =bpf_clone_redirect (skb, ifindex,0 ); +return 0 ; +} + +SEC("tc") +int tc_redirect_ingress (struct __sk_buff *skb) +{ + ret =bpf_clone_redirect (skb, ifindex,BPF_F_INGRESS ); +return 0 ; +} + +SEC("tc") +int tc_redirect_egress (struct __sk_buff *skb) +{ + ret =bpf_clone_redirect (skb, ifindex,0 ); +return 0 ; +}
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 383/1146 selftests/bpf: Mount debugfs in setns_by_fd
In reply to Greg Kroah-HartmanFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 8ac88eece8009428e2577c345080a458e4507e2f ]
Jiri reports broken test_progs after recent commit 68f8e3d4b916 ("selftests/bpf: Make sure zero-len skbs aren't redirectable"). Apparently we don't remount debugfs when we switch back networking namespace. Let's explicitly mount /sys/kernel/debug.
0: https://lore.kernel.org/bpf/[email protected]/T/#ma66ca9c92e99eee0a25e40f422489b26ee0171c1
--- tools/testing/selftests/bpf/network_helpers.c | 4 ++++ tools/testing/selftests/bpf/prog_tests/empty_skb.c | 2 +- tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c | 2 +- tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/network_helpers.c +4 -0
@@ -426,6 +426,10 @@ static int setns_by_fd(int nsfd)if (!ASSERT_OK (err,"mount /sys/fs/bpf" ))return err; + err =mount ("debugfs" ,"/sys/kernel/debug" ,"debugfs" ,0 ,NULL ); +if (!ASSERT_OK (err,"mount /sys/kernel/debug" )) +return err; +return 0 ; }
tools/testing/selftests/bpf/prog_tests/empty_skb.c +1 -1
@@ -9,7 +9,7 @@ goto out; \ }) -void test_empty_skb (void ) +void serial_test_empty_skb (void ) {LIBBPF_OPTS (bpf_test_run_opts, tattr);struct empty_skb *bpf_obj =NULL ;
tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c +1 -1
@@ -85,7 +85,7 @@ static void test_max_pkt_size(int fd) }#define NUM_PKTS 10000 -void test_xdp_do_redirect (void ) +void serial_test_xdp_do_redirect (void ) {int err, xdp_prog_fd, tc_prog_fd, ifindex_src, ifindex_dst;char data[sizeof (pkt_udp) +sizeof (__u32)];
tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c +1 -1
@@ -174,7 +174,7 @@ static void test_synproxy(bool xdp)system ("ip netns del synproxy" ); } -void test_xdp_synproxy (void ) +void serial_test_xdp_synproxy (void ) {if (test__start_subtest ("xdp" ))test_synproxy (true);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 384/1146 bonding: fix link recovery in mode 2 when updelay is nonzero
In reply to Greg Kroah-HartmanFrom: Jonathan Toppins <[email protected]>
[ Upstream commit f8a65ab2f3ff7410921ebbf0dc55453102c33c56 ]
Before this change when a bond in mode 2 lost link, all of its slaves lost link, the bonding device would never recover even after the expiration of updelay. This change removes the updelay when the bond currently has no usable links. Conforming to bonding.txt section 13.1 paragraph 4.
--- drivers/net/bonding/bond_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +10 -1
@@ -2536,7 +2536,16 @@ static int bond_miimon_inspect(struct bonding *bond)struct slave *slave;bool ignore_updelay; - ignore_updelay = !rcu_dereference (bond->curr_active_slave); +if (BOND_MODE (bond) ==BOND_MODE_ACTIVEBACKUP ) { + ignore_updelay = !rcu_dereference (bond->curr_active_slave); + }else { +struct bond_up_slave *usable_slaves; + + usable_slaves =rcu_dereference (bond->usable_slaves); + +if (usable_slaves && usable_slaves->count ==0 ) + ignore_updelay = true; + }bond_for_each_slave_rcu (bond, slave, iter) {bond_propose_link_state (slave,BOND_LINK_NOCHANGE );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 385/1146 clk: microchip: check for null return of devm_kzalloc()
In reply to Greg Kroah-HartmanFrom: Hui Tang <[email protected]>
[ Upstream commit e2e6a217a84d09785848a82599729c9a41566e3a ]
Because of the possible failure of devm_kzalloc(), name might be NULL and will cause null pointer dereference later.
Therefore, it might be better to check it and directly return -ENOMEM.
--- drivers/clk/microchip/clk-mpfs-ccc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/clk/microchip/clk-mpfs-ccc.c +6 -0
@@ -166,6 +166,9 @@ static int mpfs_ccc_register_outputs(struct device *dev, struct mpfs_ccc_out_hw_struct mpfs_ccc_out_hw_clock *out_hw = &out_hws[i];char *name =devm_kzalloc (dev,23 ,GFP_KERNEL ); +if (!name) +return -ENOMEM ; +snprintf (name,23 ,"%s_out%u" , parent->name, i); out_hw->divider.hw.init =CLK_HW_INIT_HW (name, &parent->hw, &clk_divider_ops,0 ); out_hw->divider.reg = data->pll_base[i / MPFS_CCC_OUTPUTS_PER_PLL] +
@@ -200,6 +203,9 @@ static int mpfs_ccc_register_plls(struct device *dev, struct mpfs_ccc_pll_hw_clostruct mpfs_ccc_pll_hw_clock *pll_hw = &pll_hws[i];char *name =devm_kzalloc (dev,18 ,GFP_KERNEL ); +if (!name) +return -ENOMEM ; + pll_hw->base = data->pll_base[i];snprintf (name,18 ,"ccc%s_pll%u" ,strchrnul (dev->of_node->full_name,'@' ), i); pll_hw->name = (const char *)name;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 386/1146 mtd: core: Fix refcount error in del_mtd_device()
In reply to Greg Kroah-HartmanFrom: Shang XiaoJing <[email protected]>
[ Upstream commit 56570bdad5e31c5c538cd6efff5c4510256e1bb4 ]
del_mtd_device() will call of_node_put() to mtd_get_of_node(mtd), which is mtd->dev.of_node. However, memset(&mtd->dev, 0) is called before of_node_put(). As the result, of_node_put() won't do anything in del_mtd_device(), and causes the refcount leak.
del_mtd_device()
memset(&mtd->dev, 0, sizeof(mtd->dev) # clear mtd->dev
of_node_put()
mtd_get_of_node(mtd) # mtd->dev is cleared, can't locate of_node
# of_node_put(NULL) won't do anythingFix the error by caching the pointer of the device_node.
OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /spi/spi-sram@0
CPU: 3 PID: 275 Comm: python3 Tainted: G N 6.1.0-rc3+ #54
0d8a1edddf51f172ff5226989a7565c6313b08e2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x67/0x83
kobject_get+0x155/0x160
of_node_get+0x1f/0x30
of_fwnode_get+0x43/0x70
fwnode_handle_get+0x54/0x80
fwnode_get_nth_parent+0xc9/0xe0
fwnode_full_name_string+0x3f/0xa0
device_node_string+0x30f/0x750
pointer+0x598/0x7a0
vsnprintf+0x62d/0x9b0
...
cfs_overlay_release+0x30/0x90
config_item_release+0xbe/0x1a0
config_item_put+0x5e/0x80
configfs_rmdir+0x3bd/0x540
vfs_rmdir+0x18c/0x320
do_rmdir+0x198/0x330
__x64_sys_rmdir+0x2c/0x40
do_syscall_64+0x37/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd--- drivers/mtd/mtdcore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/mtdcore.c +3 -1
@@ -776,6 +776,7 @@ int del_mtd_device(struct mtd_info *mtd) {int ret;struct mtd_notifier *not; +struct device_node *mtd_of_node;mutex_lock (&mtd_table_mutex);
@@ -794,6 +795,7 @@ int del_mtd_device(struct mtd_info *mtd) mtd->index, mtd->name, mtd->usecount); ret = -EBUSY ; }else { + mtd_of_node =mtd_get_of_node (mtd);debugfs_remove_recursive (mtd->dbg.dfs_dir);/* Try to remove the NVMEM provider */
@@ -805,7 +807,7 @@ int del_mtd_device(struct mtd_info *mtd)memset (&mtd->dev,0 ,sizeof (mtd->dev));idr_remove (&mtd_idr, mtd->index); -of_node_put (mtd_get_of_node (mtd)); +of_node_put (mtd_of_node);module_put (THIS_MODULE ); ret =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 387/1146 mtd: maps: pxa2xx-flash: fix memory leak in probe
In reply to Greg Kroah-HartmanFrom: Zheng Yongjun <[email protected]>
[ Upstream commit 2399401feee27c639addc5b7e6ba519d3ca341bf ]
Free 'info' upon remapping error to avoid a memory leak.
--- drivers/mtd/maps/pxa2xx-flash.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/maps/pxa2xx-flash.c +2 -0
@@ -64,6 +64,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)if (!info->map.virt) {printk (KERN_WARNING "Failed to ioremap %s\n" , info->map.name); +kfree (info);return -ENOMEM ; } info->map.cached =ioremap_cache (info->map.phys, info->map.size);
@@ -85,6 +86,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)iounmap ((void *)info->map.virt);if (info->map.cached)iounmap (info->map.cached); +kfree (info);return -EIO ; } info->mtd->dev.parent = &pdev->dev;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 388/1146 drbd: remove call to memset before free device/resource/connection
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit 6e7b854e4c1b02dba00760dfa79d8dbf6cce561e ]
This revert c2258ffc56f2 ("drbd: poison free'd device, resource and connection structs"), add memset is odd here for debugging, there are some methods to accurately show what happened, such as kdump.
Stable-dep-of: 8692814b77ca ("drbd: destroy workqueue when drbd device was freed")
--- drivers/block/drbd/drbd_main.c | 3 --- 1 file changed, 3 deletions(-)
drivers/block/drbd/drbd_main.c +0 -3
@@ -2217,7 +2217,6 @@ void drbd_destroy_device(struct kref *kref)kref_put (&peer_device->connection->kref, drbd_destroy_connection);kfree (peer_device); } -memset (device,0xfd ,sizeof (*device));kfree (device);kref_put (&resource->kref, drbd_destroy_resource); }
@@ -2309,7 +2308,6 @@ void drbd_destroy_resource(struct kref *kref)idr_destroy (&resource->devices);free_cpumask_var (resource->cpu_mask);kfree (resource->name); -memset (resource,0xf2 ,sizeof (*resource));kfree (resource); }
@@ -2650,7 +2648,6 @@ void drbd_destroy_connection(struct kref *kref)drbd_free_socket (&connection->data);kfree (connection->int_dig_in);kfree (connection->int_dig_vv); -memset (connection,0xfc ,sizeof (*connection));kfree (connection);kref_put (&resource->kref, drbd_destroy_resource); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 389/1146 drbd: destroy workqueue when drbd device was freed
In reply to Greg Kroah-HartmanFrom: Wang ShaoBo <[email protected]>
[ Upstream commit 8692814b77ca4228a99da8a005de0acf40af6132 ]
A submitter workqueue is dynamically allocated by init_submitter() called by drbd_create_device(), we should destroy it when this device is not needed or destroyed.
--- drivers/block/drbd/drbd_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/block/drbd/drbd_main.c +5 -1
@@ -2217,6 +2217,8 @@ void drbd_destroy_device(struct kref *kref)kref_put (&peer_device->connection->kref, drbd_destroy_connection);kfree (peer_device); } +if (device->submit.wq) +destroy_workqueue (device->submit.wq);kfree (device);kref_put (&resource->kref, drbd_destroy_resource); }
@@ -2771,7 +2773,7 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig err =add_disk (disk);if (err) - goto out_idr_remove_from_resource; + goto out_destroy_workqueue;/* inherit the connection state */ device->state.conn =first_connection (resource)->cstate;
@@ -2785,6 +2787,8 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsigdrbd_debugfs_device_add (device);return NO_ERROR ; +out_destroy_workqueue: +destroy_workqueue (device->submit.wq); out_idr_remove_from_resource:for_each_connection_safe (connection, n, resource) { peer_device =idr_remove (&connection->peer_devices, vnr);
Signature · 1 line
2.35.1