drm: Added orientation quirk for OneGX1 Pro
Subsystems (13)
Sasha Levin
maintainerPATCH 1/57 drm: Added orientation quirk for OneGX1 Pro
From: Jared Baldridge <[email protected]>
[ Upstream commit 81ad7f9f78e4ff80e95be8282423f511b84f1166 ]
The OneGX1 Pro has a fairly unique combination of generic strings, but we additionally match on the BIOS date just to be safe.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +14 -0
@@ -84,6 +84,13 @@ static const struct drm_dmi_panel_orientation_data itworks_tw891 = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data onegx1_pro = { + .width =1200 , + .height =1920 , + .bios_dates = (const char *const []){"12/17/2020" ,NULL }, + .orientation =DRM_MODE_PANEL_ORIENTATION_RIGHT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd720x1280_rightside_up = { .width =720 , .height =1280 ,
@@ -211,6 +218,13 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, + }, { /* OneGX1 Pro */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"SYSTEM_MANUFACTURER" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"SYSTEM_PRODUCT_NAME" ), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"), + }, + .driver_data = (void *)&onegx1_pro, }, { /* VIOS LTH17 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 2/57 drm/qxl: release shadow on shutdown
From: Gerd Hoffmann <[email protected]>
[ Upstream commit 4ca77c513537700d3fae69030879f781dde1904c ]
In case we have a shadow surface on shutdown release it so it doesn't leak.
--- drivers/gpu/drm/qxl/qxl_display.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/qxl/qxl_display.c +4 -0
@@ -1237,6 +1237,10 @@ int qxl_modeset_init(struct qxl_device *qdev)void qxl_modeset_fini (struct qxl_device *qdev) { +if (qdev->dumb_shadow_bo) { +drm_gem_object_put (&qdev->dumb_shadow_bo->tbo.base); + qdev->dumb_shadow_bo =NULL ; + }qxl_destroy_monitors_object (qdev);drm_mode_config_cleanup (&qdev->ddev); }
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 3/57 drm/amd/display: Check for DSC support instead of ASIC revision
In reply to Sasha LevinFrom: Eryk Brol <[email protected]>
[ Upstream commit 349a19b2f1b01e713268c7de9944ad669ccdf369 ]
[why]
This check for ASIC revision is no longer useful and causes lightup issues after a topology change in MST DSC scenario. In this case, DSC configs should be recalculated for the new topology. This check prevented that from happening on certain ASICs that do, in fact, support DSC.
[how]
Change the ASIC revision to instead check if DSC is supported.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -7330,7 +7330,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, }#if defined(CONFIG_DRM_AMD_DC_DCN ) -if (adev->asic_type >=CHIP_NAVI10 ) { +if (dc_resource_is_dsc_encoding_supported (dc)) {for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {if (drm_atomic_crtc_needs_modeset (new_crtc_state)) { ret =add_affected_mst_dsc_crtcs (state, crtc);
Signature · 6 lines
2.30.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 4/57 drm/amd/display: Don't optimize bandwidth before disabling planes
In reply to Sasha LevinFrom: Aric Cyr <[email protected]>
[ Upstream commit 6ad98e8aeb0106f453bb154933e8355849244990 ]
[Why]
There is a window of time where we optimize bandwidth due to no streams enabled will enable PSTATE changing but HUBPs are not disabled yet. This results in underflow counter increasing in some hotplug scenarios.
[How]
Set the optimize-bandwidth flag for later processing once all the HUBPs are properly disabled.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -1
@@ -1961,7 +1961,8 @@ static void commit_planes_do_stream_update(struct dc *dc,if (pipe_ctx->stream_res.audio && !dc->debug.az_endpoint_mute_only) pipe_ctx->stream_res.audio->funcs->az_disable (pipe_ctx->stream_res.audio); - dc->hwss.optimize_bandwidth (dc, dc->current_state); + dc->optimized_required = true; + }else {if (!dc->optimize_seamless_boot) dc->hwss.prepare_bandwidth (dc, dc->current_state);
Signature · 6 lines
2.30.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 10/57 media: imx: capture: Return -EPIPE from __capture_legacy_try_fmt()
In reply to Sasha LevinFrom: Laurent Pinchart <[email protected]>
[ Upstream commit cc271b6754691af74d710b761eaf027e3743e243 ]
The correct return code to report an invalid pipeline configuration is -EPIPE. Return it instead of -EINVAL from __capture_legacy_try_fmt() when the capture format doesn't match the media bus format of the connected subdev.
--- drivers/staging/media/imx/imx-media-capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-capture.c +1 -1
@@ -553,7 +553,7 @@ static int capture_validate_fmt(struct capture_priv *priv) priv->vdev.fmt.fmt.pix.height != f.fmt.pix.height || priv->vdev.cc->cs != cc->cs || priv->vdev.compose.width != compose.width || - priv->vdev.compose.height != compose.height) ? -EINVAL : 0; + priv->vdev.compose.height != compose.height) ? -EPIPE : 0; }static int capture_start_streaming (struct vb2_queue *vq,unsigned int count)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 18/57 drm/bridge/analogix/anx78xx: Setup encoder before registering connector
In reply to Sasha LevinFrom: Lyude Paul <[email protected]>
[ Upstream commit 9962849d0871f5e53d0e3b3d84561f8f2847fbf4 ]
Since encoder mappings for connectors are exposed to userspace, we should be attaching the encoder before exposing the connector to userspace. Just a drive-by fix for an issue I noticed while fixing up usages of drm_dp_aux_init()/drm_dp_aux_register() across the tree.
--- drivers/gpu/drm/bridge/analogix-anx78xx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/analogix-anx78xx.c +6 -6
@@ -1032,12 +1032,6 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge)drm_connector_helper_add (&anx78xx->connector, &anx78xx_connector_helper_funcs); - err =drm_connector_register (&anx78xx->connector); -if (err) { -DRM_ERROR ("Failed to register connector: %d\n" , err); -return err; - } - anx78xx->connector.polled =DRM_CONNECTOR_POLL_HPD ; err = drm_connector_attach_encoder(&anx78xx->connector,
@@ -1047,6 +1041,12 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge)return err; } + err =drm_connector_register (&anx78xx->connector); +if (err) { +DRM_ERROR ("Failed to register connector: %d\n" , err); +return err; + } +return 0 ; }
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 19/57 drm/bridge/analogix/anx78xx: Cleanup on error in anx78xx_bridge_attach()
In reply to Sasha LevinFrom: Lyude Paul <[email protected]>
[ Upstream commit 212ee8db84600f7b279b8645c62a112bff310995 ]
Just another issue I noticed while correcting usages of drm_dp_aux_init()/drm_dp_aux_register() around the tree. If any of the steps in anx78xx_bridge_attach() fail, we end up leaking resources. So, let's fix that (and fix leaking a DP AUX adapter in the process) by unrolling on errors.
--- drivers/gpu/drm/bridge/analogix-anx78xx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/analogix-anx78xx.c +8 -3
@@ -1026,7 +1026,7 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge) DRM_MODE_CONNECTOR_DisplayPort);if (err) {DRM_ERROR ("Failed to initialize connector: %d\n" , err); -return err; + goto aux_unregister; } drm_connector_helper_add(&anx78xx->connector,
@@ -1038,16 +1038,21 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge) bridge->encoder);if (err) {DRM_ERROR ("Failed to link up connector to encoder: %d\n" , err); -return err; + goto connector_cleanup; } err =drm_connector_register (&anx78xx->connector);if (err) {DRM_ERROR ("Failed to register connector: %d\n" , err); -return err; + goto connector_cleanup; }return 0 ; +connector_cleanup: +drm_connector_cleanup (&anx78xx->connector); +aux_unregister: +drm_dp_aux_unregister (&anx78xx->aux); +return err; } static enum drm_mode_status
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 20/57 drm/amdgpu: mask the xgmi number of hops reported from psp to kfd
In reply to Sasha LevinFrom: Jonathan Kim <[email protected]>
[ Upstream commit 4ac5617c4b7d0f0a8f879997f8ceaa14636d7554 ]
The psp supplies the link type in the upper 2 bits of the psp xgmi node information num_hops field. With a new link type, Aldebaran has these bits set to a non-zero value (1 = xGMI3) so the KFD topology will report the incorrect IO link weights without proper masking.
The actual number of hops is located in the 3 least significant bits of this field so mask if off accordingly before passing it to the KFD.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +8 -1
@@ -311,15 +311,22 @@ int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_dev } +/* +* NOTE psp_xgmi_node_info.num_hops layout is as follows: +* num_hops[7:6] = link type (0 = xGMI2, 1 = xGMI3, 2/3 = reserved) +* num_hops[5:3] = reserved +* num_hops[2:0] = number of hops +*/ int amdgpu_xgmi_get_hops_count (struct amdgpu_device *adev,struct amdgpu_device *peer_adev) {struct psp_xgmi_topology_info *top = &adev->psp.xgmi_context.top_info; +uint8_t num_hops_mask =0x7 ;int i;for (i =0 ; i < top->num_nodes; ++i)if (top->nodes[i].node_id == peer_adev->gmc.xgmi.node_id) -return top->nodes[i].num_hops; +return top->nodes[i].num_hops & num_hops_mask;return -EINVAL ; }
Signature · 6 lines
2.30.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 21/57 drm/amdkfd: Fix UBSAN shift-out-of-bounds warning
In reply to Sasha LevinFrom: Anson Jacob <[email protected]>
[ Upstream commit 50e2fc36e72d4ad672032ebf646cecb48656efe0 ]
If get_num_sdma_queues or get_num_xgmi_sdma_queues is 0, we end up doing a shift operation where the number of bits shifted equals number of bits in the operand. This behaviour is undefined.
Set num_sdma_queues or num_xgmi_sdma_queues to ULLONG_MAX, if the count is >= number of bits in the operand.
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +15 -2
@@ -1011,6 +1011,9 @@ static int set_sched_resources(struct device_queue_manager *dqm)static int initialize_cpsch (struct device_queue_manager *dqm) { +uint64_t num_sdma_queues; +uint64_t num_xgmi_sdma_queues; +pr_debug ("num of pipes: %d\n" ,get_pipes_per_mec (dqm));mutex_init (&dqm->lock_hidden);
@@ -1019,8 +1022,18 @@ static int initialize_cpsch(struct device_queue_manager *dqm) dqm->sdma_queue_count =0 ; dqm->xgmi_sdma_queue_count =0 ; dqm->active_runlist = false; - dqm->sdma_bitmap = ~0ULL >> (64 -get_num_sdma_queues (dqm)); - dqm->xgmi_sdma_bitmap = ~0ULL >> (64 -get_num_xgmi_sdma_queues (dqm)); + + num_sdma_queues =get_num_sdma_queues (dqm); +if (num_sdma_queues >=BITS_PER_TYPE (dqm->sdma_bitmap)) + dqm->sdma_bitmap =ULLONG_MAX ; +else + dqm->sdma_bitmap = (BIT_ULL (num_sdma_queues) -1 ); + + num_xgmi_sdma_queues =get_num_xgmi_sdma_queues (dqm); +if (num_xgmi_sdma_queues >=BITS_PER_TYPE (dqm->xgmi_sdma_bitmap)) + dqm->xgmi_sdma_bitmap =ULLONG_MAX ; +else + dqm->xgmi_sdma_bitmap = (BIT_ULL (num_xgmi_sdma_queues) -1 );INIT_WORK (&dqm->hw_exception_work, kfd_process_hw_exception);
Signature · 6 lines
2.30.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 22/57 drm/amdgpu : Fix asic reset regression issue introduce by 8f211fe8ac7c4f
In reply to Sasha LevinFrom: shaoyunl <[email protected]>
[ Upstream commit c8941550aa66b2a90f4b32c45d59e8571e33336e ]
This recent change introduce SDMA interrupt info printing with irq->process function. These functions do not require a set function to enable/disable the irq
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -1
@@ -469,7 +469,7 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev)for (j =0 ; j <AMDGPU_MAX_IRQ_SRC_ID ; ++j) {struct amdgpu_irq_src *src = adev->irq.client[i].sources[j]; -if (!src) +if (!src || !src->funcs || !src->funcs->set)continue ;for (k =0 ; k < src->num_types; k++)amdgpu_irq_update (adev, src, k);
Signature · 6 lines
2.30.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 23/57 drm/amd/display: Fix UBSAN warning for not a valid value for type '_Bool'
In reply to Sasha LevinFrom: Anson Jacob <[email protected]>
[ Upstream commit 6a30a92997eee49554f72b462dce90abe54a496f ]
[Why]dc_cursor_position do not initialise position.translate_by_source when crtc or plane->state->fb is NULL. UBSAN caught this error in dce110_set_cursor_position, as the value was garbage.
[How]
Initialise dc_cursor_position structure elements to 0 in handle_cursor_update before calling get_cursor_position.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -5
@@ -5372,10 +5372,6 @@ static int get_cursor_position(struct drm_plane *plane, struct drm_crtc *crtc,int x, y;int xorigin =0 , yorigin =0 ; - position->enable = false; - position->x =0 ; - position->y =0 ; -if (!crtc || !plane->state->fb)return 0 ;
@@ -5427,7 +5423,7 @@ static void handle_cursor_update(struct drm_plane *plane,struct dm_crtc_state *crtc_state = crtc ?to_dm_crtc_state (crtc->state) :NULL ;struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);uint64_t address = afb ? afb->address :0 ; -struct dc_cursor_position position; +struct dc_cursor_position position = {0 };struct dc_cursor_attributes attributes;int ret;
Signature · 6 lines
2.30.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 24/57 drm/amd/display: fix dml prefetch validation
In reply to Sasha LevinFrom: Dmytro Laktyushkin <[email protected]>
[ Upstream commit 8ee0fea4baf90e43efe2275de208a7809f9985bc ]
Incorrect variable used, missing initialization during validation.
--- drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c | 1 + drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c +1 -0
@@ -3435,6 +3435,7 @@ void dml20_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l mode_lib->vba.DCCEnabledInAnyPlane = true; } } + mode_lib->vba.UrgentLatency = mode_lib->vba.UrgentLatencyPixelDataOnly;for (i =0 ; i <= mode_lib->vba.soc.num_states; i++) { locals->FabricAndDRAMBandwidthPerState[i] =dml_min ( mode_lib->vba.DRAMSpeedPerState[i] * mode_lib->vba.NumberOfChannels
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c +1 -0
@@ -3467,6 +3467,7 @@ void dml20v2_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode mode_lib->vba.DCCEnabledInAnyPlane = true; } } + mode_lib->vba.UrgentLatency = mode_lib->vba.UrgentLatencyPixelDataOnly;for (i =0 ; i <= mode_lib->vba.soc.num_states; i++) { locals->FabricAndDRAMBandwidthPerState[i] =dml_min ( mode_lib->vba.DRAMSpeedPerState[i] * mode_lib->vba.NumberOfChannels
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 26/57 drm/vkms: fix misuse of WARN_ON
In reply to Sasha LevinFrom: Dmitry Vyukov <[email protected]>
[ Upstream commit b4142fc4d52d051d4d8df1fb6c569e5b445d369e ]
vkms_vblank_simulate() uses WARN_ON for timing-dependent condition (timer overrun). This is a mis-use of WARN_ON, WARN_ON must be used to denote kernel bugs. Use pr_warn() instead.
--- drivers/gpu/drm/vkms/vkms_crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_crtc.c +2 -1
@@ -20,7 +20,8 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) ret_overrun =hrtimer_forward_now (&output->vblank_hrtimer, output->period_ns); -WARN_ON (ret_overrun !=1 ); +if (ret_overrun !=1 ) +pr_warn ("%s: vblank timer overrun\n" , __func__); ret =drm_crtc_handle_vblank (crtc);if (!ret)
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 47/57 drm/msm/mdp5: Configure PP_SYNC_HEIGHT to double the vtotal
In reply to Sasha LevinFrom: Marijn Suijten <[email protected]>
[ Upstream commit 2ad52bdb220de5ab348098e3482b01235d15a842 ]
Leaving this at a close-to-maximum register value 0xFFF0 means it takes very long for the MDSS to generate a software vsync interrupt when the hardware TE interrupt doesn't arrive. Configuring this to double the vtotal (like some downstream kernels) leads to a frame to take at most twice before the vsync signal, until hardware TE comes up.
In this case the hardware interrupt responsible for providing this signal - "disp-te" gpio - is not hooked up to the mdp5 vsync/pp logic at all. This solves severe panel update issues observed on at least the Xperia Loire and Tone series, until said gpio is properly hooked up to an irq.
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c +9 -1
@@ -70,9 +70,17 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, | MDP5_PP_SYNC_CONFIG_VSYNC_IN_EN; cfg |=MDP5_PP_SYNC_CONFIG_VSYNC_COUNT (vclks_line); +/* +* Tearcheck emits a blanking signal every vclks_line * vtotal * 2 ticks on +* the vsync_clk equating to roughly half the desired panel refresh rate. +* This is only necessary as stability fallback if interrupts from the +* panel arrive too late or not at all, but is currently used by default +* because these panel interrupts are not wired up yet. +*/ mdp5_write (mdp5_kms,REG_MDP5_PP_SYNC_CONFIG_VSYNC (pp_id), cfg);mdp5_write (mdp5_kms, -REG_MDP5_PP_SYNC_CONFIG_HEIGHT (pp_id),0xfff0 ); +REG_MDP5_PP_SYNC_CONFIG_HEIGHT (pp_id), (2 * mode->vtotal)); +mdp5_write (mdp5_kms,REG_MDP5_PP_VSYNC_INIT_VAL (pp_id), mode->vdisplay);mdp5_write (mdp5_kms,REG_MDP5_PP_RD_PTR_IRQ (pp_id), mode->vdisplay +1 );
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 48/57 drm/msm/mdp5: Do not multiply vclk line count by 100
In reply to Sasha LevinFrom: Marijn Suijten <[email protected]>
[ Upstream commit 377569f82ea8228c421cef4da33e056a900b58ca ]
Neither vtotal nor drm_mode_vrefresh contain a value that is premultiplied by 100 making the x100 variable name incorrect and resulting in vclks_line to become 100 times larger than it is supposed to be. The hardware counts 100 clockticks too many before tearcheck, leading to severe panel issues on at least the Sony Xperia lineup.
This is likely an artifact from the original MDSS DSI panel driver where the calculation [1] corrected for a premultiplied reference framerate by 100 [2]. It does not appear that the above values were ever premultiplied in the history of the DRM MDP5 driver.
With this change applied the value written to the SYNC_CONFIG_VSYNC register is now identical to downstream kernels.
[1]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_mdp_intf_cmd.c?h=LA.UM.8.6.c26-02400-89xx.0#n288
[2]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_dsi_panel.c?h=LA.UM.8.6.c26-02400-89xx.0#n1648
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c +4 -4
@@ -41,7 +41,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, {struct mdp5_kms *mdp5_kms =get_kms (encoder);struct device *dev = encoder->dev->dev; -u32 total_lines_x100, vclks_line, cfg; +u32 total_lines, vclks_line, cfg;long vsync_clk_speed;struct mdp5_hw_mixer *mixer =mdp5_crtc_get_mixer (encoder->crtc);int pp_id = mixer->pp;
@@ -51,8 +51,8 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder,return -EINVAL ; } - total_lines_x100 = mode->vtotal *drm_mode_vrefresh (mode); -if (!total_lines_x100) { + total_lines = mode->vtotal *drm_mode_vrefresh (mode); +if (!total_lines) {DRM_DEV_ERROR (dev,"%s: vtotal(%d) or vrefresh(%d) is 0\n" , __func__, mode->vtotal,drm_mode_vrefresh (mode));return -EINVAL ;
@@ -64,7 +64,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, vsync_clk_speed);return -EINVAL ; } - vclks_line = vsync_clk_speed *100 / total_lines_x100; + vclks_line = vsync_clk_speed / total_lines; cfg =MDP5_PP_SYNC_CONFIG_VSYNC_COUNTER_EN |MDP5_PP_SYNC_CONFIG_VSYNC_IN_EN ;
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 49/57 drm/amdkfd: Fix cat debugfs hang_hws file causes system crash bug
In reply to Sasha LevinFrom: Qu Huang <[email protected]>
[ Upstream commit d73610211eec8aa027850982b1a48980aa1bc96e ]
Here is the system crash log:
[ 1272.884438] BUG: unable to handle kernel NULL pointer dereference at (null) [ 1272.884444] IP: [< (null)>] (null) [ 1272.884447] PGD 825b09067 PUD 8267c8067 PMD 0 [ 1272.884452] Oops: 0010 [#1] SMP [ 1272.884509] CPU: 13 PID: 3485 Comm: cat Kdump: loaded Tainted: G [ 1272.884515] task: ffff9a38dbd4d140 ti: ffff9a37cd3b8000 task.ti: ffff9a37cd3b8000 [ 1272.884517] RIP: 0010:[<0000000000000000>] [< (null)>] (null) [ 1272.884520] RSP: 0018:ffff9a37cd3bbe68 EFLAGS: 00010203 [ 1272.884522] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000014d5f [ 1272.884524] RDX: fffffffffffffff4 RSI: 0000000000000001 RDI: ffff9a38aca4d200 [ 1272.884526] RBP: ffff9a37cd3bbed0 R08: ffff9a38dcd5f1a0 R09: ffff9a31ffc07300 [ 1272.884527] R10: ffff9a31ffc07300 R11: ffffffffaddd5e9d R12: ffff9a38b4e0fb00 [ 1272.884529] R13: 0000000000000001 R14: ffff9a37cd3bbf18 R15: ffff9a38aca4d200 [ 1272.884532] FS: 00007feccaa67740(0000) GS:ffff9a38dcd40000(0000) knlGS:0000000000000000 [ 1272.884534] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1272.884536] CR2: 0000000000000000 CR3: 00000008267c0000 CR4: 00000000003407e0 [ 1272.884537] Call Trace: [ 1272.884544] [<ffffffffade68940>] ? seq_read+0x130/0x440 [ 1272.884548] [<ffffffffade40f8f>] vfs_read+0x9f/0x170 [ 1272.884552] [<ffffffffade41e4f>] SyS_read+0x7f/0xf0 [ 1272.884557] [<ffffffffae374ddb>] system_call_fastpath+0x22/0x27 [ 1272.884558] Code: Bad RIP value. [ 1272.884562] RIP [< (null)>] (null) [ 1272.884564] RSP <ffff9a37cd3bbe68> [ 1272.884566] CR2: 0000000000000000
--- drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c +6 -1
@@ -33,6 +33,11 @@ static int kfd_debugfs_open(struct inode *inode, struct file *file)return single_open (file, show,NULL ); } +static int kfd_debugfs_hang_hws_read (struct seq_file *m,void *data) +{ +seq_printf (m,"echo gpu_id > hang_hws\n" ); +return 0 ; +}static ssize_t kfd_debugfs_hang_hws_write (struct file *file,const char __user *user_buf,size_t size,loff_t *ppos)
@@ -94,7 +99,7 @@ void kfd_debugfs_init(void)debugfs_create_file ("rls" ,S_IFREG |0444 , debugfs_root, kfd_debugfs_rls_by_device, &kfd_debugfs_fops);debugfs_create_file ("hang_hws" ,S_IFREG |0200 , debugfs_root, -NULL , &kfd_debugfs_hang_hws_fops); + kfd_debugfs_hang_hws_read, &kfd_debugfs_hang_hws_fops); }void kfd_debugfs_fini (void )
Signature · 6 lines
2.30.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 50/57 amdgpu: avoid incorrect %hu format string
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7d98d416c2cc1c1f7d9508e887de4630e521d797 ]
clang points out that the %hu format string does not match the type of the variables here:
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:263:7: warning: format specifies type 'unsigned short' but the argument has type 'unsigned int' [-Wformat]
version_major, version_minor);
^~~~~~~~~~~~~
include/drm/drm_print.h:498:19: note: expanded from macro 'DRM_ERROR'
__drm_err(fmt, ##__VA_ARGS__)
~~~ ^~~~~~~~~~~Change it to a regular %u, the same way a previous patch did for another instance of the same warning.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
@@ -231,7 +231,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)if ((adev->asic_type ==CHIP_POLARIS10 || adev->asic_type ==CHIP_POLARIS11 ) && (adev->uvd.fw_version <FW_1_66_16 )) -DRM_ERROR ("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n" , +DRM_ERROR ("POLARIS10/11 UVD firmware version %u.%u is too old.\n" , version_major, version_minor); }else {unsigned int enc_major, enc_minor, dec_minor;
Signature · 6 lines
2.30.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 51/57 drm/amdgpu: fix NULL pointer dereference
In reply to Sasha LevinFrom: Guchun Chen <[email protected]>
[ Upstream commit 3c3dc654333f6389803cdcaf03912e94173ae510 ]
ttm->sg needs to be checked before accessing its child member.
Call Trace: amdgpu_ttm_backend_destroy+0x12/0x70 [amdgpu] ttm_bo_cleanup_memtype_use+0x3a/0x60 [ttm] ttm_bo_release+0x17d/0x300 [ttm] amdgpu_bo_unref+0x1a/0x30 [amdgpu] amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu+0x78b/0x8b0 [amdgpu] kfd_ioctl_alloc_memory_of_gpu+0x118/0x220 [amdgpu] kfd_ioctl+0x222/0x400 [amdgpu] ? kfd_dev_is_large_bar+0x90/0x90 [amdgpu] __x64_sys_ioctl+0x8e/0xd0 ? __context_tracking_exit+0x52/0x90 do_syscall_64+0x33/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f97f264d317 Code: b3 66 90 48 8b 05 71 4b 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 41 4b 2d 00 f7 d8 64 89 01 48 RSP: 002b:00007ffdb402c338 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f97f3cc63a0 RCX: 00007f97f264d317 RDX: 00007ffdb402c380 RSI: 00000000c0284b16 RDI: 0000000000000003 RBP: 00007ffdb402c380 R08: 00007ffdb402c428 R09: 00000000c4000004 R10: 00000000c4000004 R11: 0000000000000246 R12: 00000000c0284b16 R13: 0000000000000003 R14: 00007f97f3cc63a0 R15: 00007f8836200000
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -984,7 +984,7 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm) DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;/* double check that we don't free the table twice */ -if (!ttm->sg->sgl) +if (!ttm->sg || !ttm->sg->sgl)return ;/* unmap the pages mapped to the device */
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 28/57 mmc: sdhci-pci: Add PCI IDs for Intel LKF
In reply to Sasha LevinFrom: Adrian Hunter <[email protected]>
[ Upstream commit ee629112be8b4eff71d4d3d108a28bc7dc877e13 ]
Add PCI IDs for Intel LKF eMMC and SD card host controllers.
--- drivers/mmc/host/sdhci-pci-core.c | 2 ++ drivers/mmc/host/sdhci-pci.h | 2 ++ 2 files changed, 4 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +2 -0
@@ -1907,6 +1907,8 @@ static const struct pci_device_id pci_ids[] = {SDHCI_PCI_DEVICE (INTEL ,CMLH_SD , intel_byt_sd),SDHCI_PCI_DEVICE (INTEL ,JSL_EMMC , intel_glk_emmc),SDHCI_PCI_DEVICE (INTEL ,JSL_SD , intel_byt_sd), +SDHCI_PCI_DEVICE (INTEL ,LKF_EMMC , intel_glk_emmc), +SDHCI_PCI_DEVICE (INTEL ,LKF_SD , intel_byt_sd),SDHCI_PCI_DEVICE (O2 ,8120 , o2),SDHCI_PCI_DEVICE (O2 ,8220 , o2), SDHCI_PCI_DEVICE(O2, 8221, o2),
drivers/mmc/host/sdhci-pci.h +2 -0
@@ -57,6 +57,8 @@#define PCI_DEVICE_ID_INTEL_CMLH_SD 0x06f5#define PCI_DEVICE_ID_INTEL_JSL_EMMC 0x4dc4#define PCI_DEVICE_ID_INTEL_JSL_SD 0x4df8 +#define PCI_DEVICE_ID_INTEL_LKF_EMMC 0x98c4 +#define PCI_DEVICE_ID_INTEL_LKF_SD 0x98f8#define PCI_DEVICE_ID_SYSKONNECT_8000 0x8000#define PCI_DEVICE_ID_VIA_95D0 0x95d0
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 29/57 ata: ahci: Disable SXS for Hisilicon Kunpeng920
In reply to Sasha LevinFrom: Xingui Yang <[email protected]>
[ Upstream commit 234e6d2c18f5b080cde874483c4c361f3ae7cffe ]
On Hisilicon Kunpeng920, ESP is set to 1 by default for all ports of SATA controller. In some scenarios, some ports are not external SATA ports, and it cause disks connected to these ports to be identified as removable disks. So disable the SXS capability on the software side to prevent users from mistakenly considering non-removable disks as removable disks and performing related operations.
--- drivers/ata/ahci.c | 5 +++++ drivers/ata/ahci.h | 1 + drivers/ata/libahci.c | 5 +++++ 3 files changed, 11 insertions(+)
drivers/ata/ahci.c +5 -0
@@ -1728,6 +1728,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) hpriv->flags |=AHCI_HFLAG_NO_DEVSLP ;#ifdef CONFIG_ARM64 +if (pdev->vendor ==PCI_VENDOR_ID_HUAWEI && + pdev->device ==0xa235 && + pdev->revision <0x30 ) + hpriv->flags |=AHCI_HFLAG_NO_SXS ; +if (pdev->vendor ==0x177d && pdev->device ==0xa01c ) hpriv->irq_handler = ahci_thunderx_irq_handler;#endif
drivers/ata/ahci.h +1 -0
@@ -242,6 +242,7 @@ enum {suspend/resume */ AHCI_HFLAG_IGN_NOTSUPP_POWER_ON = (1 <<27 ),/* ignore -EOPNOTSUPP from phy_power_on() */ + AHCI_HFLAG_NO_SXS = (1 << 28), /* SXS not supported *//* ap->flags bits */
drivers/ata/libahci.c +5 -0
@@ -493,6 +493,11 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv) cap |=HOST_CAP_ALPM ; } +if ((cap &HOST_CAP_SXS ) && (hpriv->flags &AHCI_HFLAG_NO_SXS )) { +dev_info (dev,"controller does not support SXS, disabling CAP_SXS\n" ); + cap &= ~HOST_CAP_SXS ; + } +if (hpriv->force_port_map && port_map != hpriv->force_port_map) {dev_info (dev,"forcing port_map 0x%x -> 0x%x\n" , port_map, hpriv->force_port_map);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 5/57 scsi: lpfc: Fix incorrect dbde assignment when building target abts wqe
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 9302154c07bff4e7f7f43c506a1ac84540303d06 ]
The wqe_dbde field indicates whether a Data BDE is present in Words 0:2 and should therefore should be clear in the abts request wqe. By setting the bit we can be misleading fw into error cases.
Clear the wqe_dbde field.
--- drivers/scsi/lpfc/lpfc_nvmet.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/lpfc/lpfc_nvmet.c +0 -1
@@ -3204,7 +3204,6 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba,bf_set (wqe_rcvoxid, &wqe_abts->xmit_sequence.wqe_com, xri);/* Word 10 */ -bf_set (wqe_dbde, &wqe_abts->xmit_sequence.wqe_com,1 );bf_set (wqe_iod, &wqe_abts->xmit_sequence.wqe_com,LPFC_WQE_IOD_WRITE );bf_set (wqe_lenloc, &wqe_abts->xmit_sequence.wqe_com,LPFC_WQE_LENLOC_WORD12 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 6/57 scsi: lpfc: Fix pt2pt connection does not recover after LOGO
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit bd4f5100424d17d4e560d6653902ef8e49b2fc1f ]
On a pt2pt setup, between 2 initiators, if one side issues a a LOGO, there is no relogin attempt. The FC specs are grey in this area on which port (higher wwn or not) is to re-login.
As there is no spec guidance, unconditionally re-PLOGI after the logout to ensure a login is re-established.
--- drivers/scsi/lpfc/lpfc_nportdisc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_nportdisc.c +7 -2
@@ -888,9 +888,14 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, } }else if ((!(ndlp->nlp_type &NLP_FABRIC ) && ((ndlp->nlp_type &NLP_FCP_TARGET ) || - !(ndlp->nlp_type &NLP_FCP_INITIATOR ))) || + (ndlp->nlp_type &NLP_NVME_TARGET ) || + (vport->fc_flag &FC_PT2PT ))) || (ndlp->nlp_state ==NLP_STE_ADISC_ISSUE )) { -/* Only try to re-login if this is NOT a Fabric Node */ +/* Only try to re-login if this is NOT a Fabric Node +* AND the remote NPORT is a FCP/NVME Target or we +* are in pt2pt mode. NLP_STE_ADISC_ISSUE is a special +* case for LOGO as a response to ADISC behavior. +*/ mod_timer (&ndlp->nlp_delayfunc, jiffies +msecs_to_jiffies (1000 *1 ));spin_lock_irq (shost->host_lock);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 7/57 scsi: target: pscsi: Fix warning in pscsi_complete_cmd()
In reply to Sasha LevinFrom: Chaitanya Kulkarni <[email protected]>
[ Upstream commit fd48c056a32ed6e7754c7c475490f3bed54ed378 ]
This fixes a compilation warning in pscsi_complete_cmd():
drivers/target/target_core_pscsi.c: In function ‘pscsi_complete_cmd’:
drivers/target/target_core_pscsi.c:624:5: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] ; /* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */
--- drivers/target/target_core_pscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/target/target_core_pscsi.c +2 -1
@@ -620,8 +620,9 @@ static void pscsi_complete_cmd(struct se_cmd *cmd, u8 scsi_status,unsigned char *buf; buf =transport_kmap_data_sg (cmd); -if (!buf) +if (!buf) { ;/* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */ + }if (cdb[0 ] ==MODE_SENSE_10 ) {if (!(buf[3 ] &0x80 ))
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 8/57 media: ite-cir: check for receive overflow
In reply to Sasha LevinFrom: Sean Young <[email protected]>
[ Upstream commit 28c7afb07ccfc0a939bb06ac1e7afe669901c65a ]
It's best if this condition is reported.
--- drivers/media/rc/ite-cir.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/rc/ite-cir.c +7 -1
@@ -276,8 +276,14 @@ static irqreturn_t ite_cir_isr(int irq, void *data)/* read the interrupt flags */ iflags = dev->params.get_irq_causes (dev); +/* Check for RX overflow */ +if (iflags &ITE_IRQ_RX_FIFO_OVERRUN ) { +dev_warn (&dev->rdev->dev,"receive overflow\n" ); +ir_raw_event_reset (dev->rdev); + } +/* check for the receive interrupt */ -if (iflags & (ITE_IRQ_RX_FIFO |ITE_IRQ_RX_FIFO_OVERRUN )) { +if (iflags &ITE_IRQ_RX_FIFO ) {/* read the FIFO bytes */ rx_bytes = dev->params.get_rx_bytes(dev, rx_buf,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 9/57 media: drivers: media: pci: sta2x11: fix Kconfig dependency on GPIOLIB
In reply to Sasha LevinFrom: Julian Braha <[email protected]>
[ Upstream commit 24df8b74c8b2fb42c49ffe8585562da0c96446ff ]
When STA2X11_VIP is enabled, and GPIOLIB is disabled, Kbuild gives the following warning:
WARNING: unmet direct dependencies detected for VIDEO_ADV7180
Depends on [n]: MEDIA_SUPPORT [=y] && GPIOLIB [=n] && VIDEO_V4L2 [=y] && I2C [=y]
Selected by [y]:
- STA2X11_VIP [=y] && MEDIA_SUPPORT [=y] && MEDIA_PCI_SUPPORT [=y] && MEDIA_CAMERA_SUPPORT [=y] && PCI [=y] && VIDEO_V4L2 [=y] && VIRT_TO_BUS [=y] && I2C [=y] && (STA2X11 [=n] || COMPILE_TEST [=y]) && MEDIA_SUBDRV_AUTOSELECT [=y]
This is because STA2X11_VIP selects VIDEO_ADV7180
without selecting or depending on GPIOLIB,
despite VIDEO_ADV7180 depending on GPIOLIB.
--- drivers/media/pci/sta2x11/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/sta2x11/Kconfig +1 -0
@@ -2,6 +2,7 @@ config STA2X11_VIP tristate "STA2X11 VIP Video For Linux" depends on STA2X11 || COMPILE_TEST + select GPIOLIB if MEDIA_SUBDRV_AUTOSELECT select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT select VIDEOBUF2_DMA_CONTIG depends on PCI && VIDEO_V4L2 && VIRT_TO_BUS
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 11/57 power: supply: bq27xxx: fix power_avg for newer ICs
In reply to Sasha LevinFrom: Matthias Schiffer <[email protected]>
[ Upstream commit c4d57c22ac65bd503716062a06fad55a01569cac ]
On all newer bq27xxx ICs, the AveragePower register contains a signed value; in addition to handling the raw value as unsigned, the driver code also didn't convert it to µW as expected.
At least for the BQ28Z610, the reference manual incorrectly states that the value is in units of 1mW and not 10mW. I have no way of knowing whether the manuals of other supported ICs contain the same error, or if there are models that actually use 1mW. At least, the new code shouldn't be *less* correct than the old version for any device.
power_avg is removed from the cache structure, se we don't have to extend it to store both a signed value and an error code. Always getting an up-to-date value may be desirable anyways, as it avoids inconsistent current and power readings when switching between charging and discharging.
--- drivers/power/supply/bq27xxx_battery.c | 51 ++++++++++++++------------ include/linux/power/bq27xxx_battery.h | 1 - 2 files changed, 27 insertions(+), 25 deletions(-)
drivers/power/supply/bq27xxx_battery.c +27 -24
@@ -1499,27 +1499,6 @@ static int bq27xxx_battery_read_time(struct bq27xxx_device_info *di, u8 reg)return tval *60 ; } -/* -* Read an average power register. -* Return < 0 if something fails. -*/ -static int bq27xxx_battery_read_pwr_avg (struct bq27xxx_device_info *di) -{ -int tval; - - tval =bq27xxx_read (di,BQ27XXX_REG_AP , false); -if (tval <0 ) { -dev_err (di->dev,"error reading average power register %02x: %d\n" , -BQ27XXX_REG_AP , tval); -return tval; - } - -if (di->opts &BQ27XXX_O_ZERO ) -return (tval *BQ27XXX_POWER_CONSTANT ) /BQ27XXX_RS ; -else -return tval; -} -/* * Returns true if a battery over temperature condition is detected */
@@ -1604,8 +1583,6 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di) }if (di->regs[BQ27XXX_REG_CYCT ] !=INVALID_REG_ADDR ) cache.cycle_count =bq27xxx_battery_read_cyct (di); -if (di->regs[BQ27XXX_REG_AP ] !=INVALID_REG_ADDR ) - cache.power_avg =bq27xxx_battery_read_pwr_avg (di);/* We only have to read charge design full once */ if (di->charge_design_full <=0 )
@@ -1668,6 +1645,32 @@ static int bq27xxx_battery_current(struct bq27xxx_device_info *di,return 0 ; } +/* +* Get the average power in µW +* Return < 0 if something fails. +*/ +static int bq27xxx_battery_pwr_avg (struct bq27xxx_device_info *di, +union power_supply_propval *val) +{ +int power; + + power =bq27xxx_read (di,BQ27XXX_REG_AP , false); +if (power <0 ) { +dev_err (di->dev, +"error reading average power register %02x: %d\n" , +BQ27XXX_REG_AP , power); +return power; + } + +if (di->opts &BQ27XXX_O_ZERO ) + val->intval = (power *BQ27XXX_POWER_CONSTANT ) /BQ27XXX_RS ; +else +/* Other gauges return a signed value in units of 10mW */ + val->intval = (int )((s16 )power) *10000 ; + +return 0 ; +} +static int bq27xxx_battery_status (struct bq27xxx_device_info *di,union power_supply_propval *val) {
@@ -1835,7 +1838,7 @@ static int bq27xxx_battery_get_property(struct power_supply *psy, ret =bq27xxx_simple_value (di->cache.energy, val);break ;case POWER_SUPPLY_PROP_POWER_AVG : - ret =bq27xxx_simple_value (di->cache.power_avg, val); + ret =bq27xxx_battery_pwr_avg (di, val);break ;case POWER_SUPPLY_PROP_HEALTH : ret =bq27xxx_simple_value (di->cache.health, val);
include/linux/power/bq27xxx_battery.h +0 -1
@@ -50,7 +50,6 @@ struct bq27xxx_reg_cache {int capacity;int energy;int flags; -int power_avg;int health; };
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 35/57 clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 657d4d1934f75a2d978c3cf2086495eaa542e7a9 ]
There is an error return path that is not kfree'ing socfpga_clk leading to a memory leak. Fix this by adding in the missing kfree call.
Addresses-Coverity: ("Resource leak")
--- drivers/clk/socfpga/clk-gate-a10.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/socfpga/clk-gate-a10.c +1 -0
@@ -146,6 +146,7 @@ static void __init __socfpga_gate_init(struct device_node *node,if (IS_ERR (socfpga_clk->sys_mgr_base_addr)) {pr_err ("%s: failed to find altr,sys-mgr regmap!\n" , __func__); +kfree (socfpga_clk);return ; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 12/57 extcon: arizona: Fix some issues when HPDET IRQ fires after the jack has been unplugged
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit c309a3e8793f7e01c4a4ec7960658380572cb576 ]
When the jack is partially inserted and then removed again it may be removed while the hpdet code is running. In this case the following may happen:
1. The "JACKDET rise" or ""JACKDET fall" IRQ triggers
2. arizona_jackdet runs and takes info->lock
3. The "HPDET" IRQ triggers
4. arizona_hpdet_irq runs, blocks on info->lock
5. arizona_jackdet calls arizona_stop_mic() and clears info->hpdet_done
6. arizona_jackdet releases info->lock
7. arizona_hpdet_irq now can continue running and:
7.1 Calls arizona_start_mic() (if a mic was detected)
7.2 sets info->hpdet_done
Step 7 is undesirable / a bug:
7.1 causes the device to stay in a high power-state (with MICVDD enabled) 7.2 causes hpdet to not run on the next jack insertion, which in turn
causes the EXTCON_JACK_HEADPHONE state to never get set
This fixes both issues by skipping these 2 steps when arizona_hpdet_irq runs after the jack has been unplugged.
--- drivers/extcon/extcon-arizona.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/extcon/extcon-arizona.c +9 -8
@@ -597,7 +597,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)struct arizona *arizona = info->arizona;int id_gpio = arizona->pdata.hpdet_id_gpio;unsigned int report =EXTCON_JACK_HEADPHONE ; -int ret, reading; +int ret, reading, state;bool mic = false;mutex_lock (&info->lock);
@@ -610,12 +610,11 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) }/* If the cable was removed while measuring ignore the result */ - ret =extcon_get_state (info->edev,EXTCON_MECHANICAL ); -if (ret <0 ) { -dev_err (arizona->dev,"Failed to check cable state: %d\n" , - ret); + state =extcon_get_state (info->edev,EXTCON_MECHANICAL ); +if (state <0 ) { +dev_err (arizona->dev,"Failed to check cable state: %d\n" , state); goto out; - }else if (!ret) { + }else if (!state) {dev_dbg (arizona->dev,"Ignoring HPDET for removed cable\n" ); goto done; }
@@ -668,7 +667,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);/* If we have a mic then reenable MICDET */ -if (mic || info->mic) +if (state && (mic || info->mic))arizona_start_mic (info);if (info->hpdet_active) {
@@ -676,7 +675,9 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) info->hpdet_active = false; } - info->hpdet_done = true; +/* Do not set hp_det done when the cable has been unplugged */ +if (state) + info->hpdet_done = true; out:mutex_unlock (&info->lock);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 13/57 extcon: arizona: Fix various races on driver unbind
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit e5b499f6fb17bc95a813e85d0796522280203806 ]
We must free/disable all interrupts and cancel all pending works before doing further cleanup.
Before this commit arizona_extcon_remove() was doing several register writes to shut things down before disabling the IRQs and it was cancelling only 1 of the 3 different works used.
Move all the register-writes shutting things down to after the disabling of the IRQs and add the 2 missing cancel_delayed_work_sync() calls.
This fixes various possible races on driver unbind. One of which would always trigger on devices using the mic-clamp feature for jack detection. The ARIZONA_MICD_CLAMP_MODE_MASK update was done before disabling the IRQs, causing:
1. arizona_jackdet() to run
2. detect a jack being inserted (clamp disabled means jack inserted)
3. call arizona_start_mic() which:
3.1 Enables the MICVDD regulator
3.2 takes a pm_runtime_reference
And this was all happening after the ARIZONA_MICD_ENA bit clearing, which would undo 3.1 and 3.2 because the ARIZONA_MICD_CLAMP_MODE_MASK update was being done after the ARIZONA_MICD_ENA bit clearing.
So this means that arizona_extcon_remove() would exit with
1. MICVDD enabled and 2. The pm_runtime_reference being unbalanced.
MICVDD still being enabled caused the following oops when the regulator is released by the devm framework:
[ 2850.745757] ------------[ cut here ]------------ [ 2850.745827] WARNING: CPU: 2 PID: 2098 at drivers/regulator/core.c:2123 _regulator_put.part.0+0x19f/0x1b0 [ 2850.745835] Modules linked in: extcon_arizona ... ... [ 2850.746909] Call Trace: [ 2850.746932] regulator_put+0x2d/0x40 [ 2850.746946] release_nodes+0x22a/0x260 [ 2850.746984] __device_release_driver+0x190/0x240 [ 2850.747002] driver_detach+0xd4/0x120 ... [ 2850.747337] ---[ end trace f455dfd7abd9781f ]---
Note this oops is just one of various theoretically possible races caused by the wrong ordering inside arizona_extcon_remove(), this fixes the ordering fixing all possible races, including the reported oops.
--- drivers/extcon/extcon-arizona.c | 40 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-)
drivers/extcon/extcon-arizona.c +21 -19
@@ -1725,25 +1725,6 @@ static int arizona_extcon_remove(struct platform_device *pdev)bool change;int ret; - ret =regmap_update_bits_check (arizona->regmap,ARIZONA_MIC_DETECT_1 , -ARIZONA_MICD_ENA ,0 , - &change); -if (ret <0 ) { -dev_err (&pdev->dev,"Failed to disable micd on remove: %d\n" , - ret); - }else if (change) { -regulator_disable (info->micvdd); -pm_runtime_put (info->dev); - } - -gpiod_put (info->micd_pol_gpio); - -pm_runtime_disable (&pdev->dev); - -regmap_update_bits (arizona->regmap, -ARIZONA_MICD_CLAMP_CONTROL , -ARIZONA_MICD_CLAMP_MODE_MASK ,0 ); -if (info->micd_clamp) { jack_irq_rise =ARIZONA_IRQ_MICD_CLAMP_RISE ; jack_irq_fall =ARIZONA_IRQ_MICD_CLAMP_FALL ;
@@ -1759,10 +1740,31 @@ static int arizona_extcon_remove(struct platform_device *pdev)arizona_free_irq (arizona, jack_irq_rise, info);arizona_free_irq (arizona, jack_irq_fall, info);cancel_delayed_work_sync (&info->hpdet_work); +cancel_delayed_work_sync (&info->micd_detect_work); +cancel_delayed_work_sync (&info->micd_timeout_work); + + ret =regmap_update_bits_check (arizona->regmap,ARIZONA_MIC_DETECT_1 , +ARIZONA_MICD_ENA ,0 , + &change); +if (ret <0 ) { +dev_err (&pdev->dev,"Failed to disable micd on remove: %d\n" , + ret); + }else if (change) { +regulator_disable (info->micvdd); +pm_runtime_put (info->dev); + } + +regmap_update_bits (arizona->regmap, +ARIZONA_MICD_CLAMP_CONTROL , +ARIZONA_MICD_CLAMP_MODE_MASK ,0 );regmap_update_bits (arizona->regmap,ARIZONA_JACK_DETECT_ANALOGUE ,ARIZONA_JD1_ENA ,0 );arizona_clk32k_disable (arizona); +gpiod_put (info->micd_pol_gpio); + +pm_runtime_disable (&pdev->dev); +return 0 ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 14/57 media: media/saa7164: fix saa7164_encoder_register() memory leak bugs
In reply to Sasha LevinFrom: Daniel Niv <[email protected]>
[ Upstream commit c759b2970c561e3b56aa030deb13db104262adfe ]
Add a fix for the memory leak bugs that can occur when the saa7164_encoder_register() function fails.
The function allocates memory without explicitly freeing
it when errors occur.
Add a better error handling that deallocate the unused buffers before the function exits during a fail.
--- drivers/media/pci/saa7164/saa7164-encoder.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/media/pci/saa7164/saa7164-encoder.c +11 -9
@@ -1008,7 +1008,7 @@ int saa7164_encoder_register(struct saa7164_port *port)printk (KERN_ERR "%s() failed (errno = %d), NO PCI configuration\n" , __func__, result); result = -ENOMEM ; - goto failed; + goto fail_pci; }/* Establish encoder defaults here */
@@ -1062,7 +1062,7 @@ int saa7164_encoder_register(struct saa7164_port *port) 100000, ENCODER_DEF_BITRATE);if (hdl->error) { result = hdl->error; - goto failed; + goto fail_hdl; } port->std =V4L2_STD_NTSC_M ;
@@ -1080,7 +1080,7 @@ int saa7164_encoder_register(struct saa7164_port *port)printk (KERN_INFO "%s: can't allocate mpeg device\n" , dev->name); result = -ENOMEM ; - goto failed; + goto fail_hdl; } port->v4l_device->ctrl_handler = hdl;
@@ -1091,10 +1091,7 @@ int saa7164_encoder_register(struct saa7164_port *port)if (result <0 ) {printk (KERN_INFO "%s: can't register mpeg device\n" , dev->name); -/* TODO: We're going to leak here if we don't dealloc -The buffers above. The unreg function can't deal wit it. -*/ - goto failed; + goto fail_reg; } printk(KERN_INFO "%s: registered device video%d [mpeg]\n",
@@ -1116,9 +1113,14 @@ int saa7164_encoder_register(struct saa7164_port *port)saa7164_api_set_encoder (port);saa7164_api_get_encoder (port); +return 0 ; - result =0 ; -failed: +fail_reg: +video_device_release (port->v4l_device); + port->v4l_device =NULL ; +fail_hdl: +v4l2_ctrl_handler_free (hdl); +fail_pci:return result; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 15/57 media: gspca/sq905.c: fix uninitialized variable
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit eaaea4681984c79d2b2b160387b297477f0c1aab ]
act_len can be uninitialized if usb_bulk_msg() returns an error. Set it to 0 to avoid a KMSAN error.
--- drivers/media/usb/gspca/sq905.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/gspca/sq905.c +1 -1
@@ -158,7 +158,7 @@ static int sq905_read_data(struct gspca_dev *gspca_dev, u8 *data, int size, int need_lock) { int ret; -int act_len; +int act_len =0 ; gspca_dev->usb_buf[0 ] ='\0' ;if (need_lock)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 16/57 media: pci: saa7164: Rudimentary spelling fixes in the file saa7164-types.h
In reply to Sasha LevinFrom: Bhaskar Chowdhury <[email protected]>
[ Upstream commit 4b19f9716ad89af51f07f9b611aabfd5fd80c625 ]
s/structues/structures/
s/decies/decides/
--- drivers/media/pci/saa7164/saa7164-types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/saa7164/saa7164-types.h +2 -2
@@ -7,7 +7,7 @@/* TODO: Cleanup and shorten the namespace */ -/* Some structues are passed directly to/from the firmware and +/* Some structures are passed directly to/from the firmware and * have strict alignment requirements. This is one of them. */ struct tmComResHWDescr {
@@ -28,7 +28,7 @@ struct tmComResHWDescr {/* This is DWORD aligned on windows but I can't find the right * gcc syntax to match the binary data from the device. * I've manually padded with Reserved[3] bytes to match the hardware, -* but this could break if GCC decies to pack in a different way. +* but this could break if GCC decides to pack in a different way. */ struct tmComResInterfaceDescr {u8 bLength;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 17/57 power: supply: Use IRQF_ONESHOT
In reply to Sasha LevinFrom: dongjian <[email protected]>
[ Upstream commit 2469b836fa835c67648acad17d62bc805236a6ea ]
Fixes coccicheck error:
drivers/power/supply/pm2301_charger.c:1089:7-27: ERROR:
drivers/power/supply/lp8788-charger.c:502:8-28: ERROR:
drivers/power/supply/tps65217_charger.c:239:8-33: ERROR:
drivers/power/supply/tps65090-charger.c:303:8-33: ERROR:
Threaded IRQ with no primary handler requested without IRQF_ONESHOT
--- drivers/power/supply/lp8788-charger.c | 2 +- drivers/power/supply/pm2301_charger.c | 2 +- drivers/power/supply/tps65090-charger.c | 2 +- drivers/power/supply/tps65217_charger.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/power/supply/lp8788-charger.c +1 -1
@@ -501,7 +501,7 @@ static int lp8788_set_irqs(struct platform_device *pdev, ret =request_threaded_irq (virq,NULL , lp8788_charger_irq_thread, -0 , name, pchg); +IRQF_ONESHOT , name, pchg);if (ret)break ; }
drivers/power/supply/pm2301_charger.c +1 -1
@@ -1095,7 +1095,7 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client, ret =request_threaded_irq (gpio_to_irq (pm2->pdata->gpio_irq_number),NULL , pm2xxx_charger_irq[0 ].isr, - pm2->pdata->irq_type, + pm2->pdata->irq_type |IRQF_ONESHOT , pm2xxx_charger_irq[0 ].name, pm2);if (ret !=0 ) {
drivers/power/supply/tps65090-charger.c +1 -1
@@ -301,7 +301,7 @@ static int tps65090_charger_probe(struct platform_device *pdev)if (irq != -ENXIO ) { ret =devm_request_threaded_irq (&pdev->dev, irq,NULL , - tps65090_charger_isr,0 ,"tps65090-charger" , cdata); + tps65090_charger_isr,IRQF_ONESHOT ,"tps65090-charger" , cdata);if (ret) { dev_err(cdata->dev, "Unable to register irq %d err %d\n", irq,
drivers/power/supply/tps65217_charger.c +1 -1
@@ -238,7 +238,7 @@ static int tps65217_charger_probe(struct platform_device *pdev)for (i =0 ; i <NUM_CHARGER_IRQS ; i++) { ret =devm_request_threaded_irq (&pdev->dev, irq[i],NULL , tps65217_charger_irq, -0 ,"tps65217-charger" , +IRQF_ONESHOT ,"tps65217-charger" , charger);if (ret) { dev_err(charger->dev,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 25/57 scsi: qla2xxx: Always check the return value of qla24xx_get_isp_stats()
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit a2b2cc660822cae08c351c7f6b452bfd1330a4f7 ]
This patch fixes the following Coverity warning:
CID 361199 (#1 of 1): Unchecked return value (CHECKED_RETURN)
3. check_return: Calling qla24xx_get_isp_stats without checking return value (as is done elsewhere 4 out of 5 times).
--- drivers/scsi/qla2xxx/qla_attr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_attr.c +7 -1
@@ -2691,6 +2691,8 @@ qla2x00_reset_host_stats(struct Scsi_Host *shost) vha->qla_stats.jiffies_at_last_reset =get_jiffies_64 ();if (IS_FWI2_CAPABLE (ha)) { +int rval; + stats =dma_alloc_coherent (&ha->pdev->dev,sizeof (*stats), &stats_dma,GFP_KERNEL );if (!stats) {
@@ -2700,7 +2702,11 @@ qla2x00_reset_host_stats(struct Scsi_Host *shost) }/* reset firmware statistics */ -qla24xx_get_isp_stats (base_vha, stats, stats_dma,BIT_0 ); + rval =qla24xx_get_isp_stats (base_vha, stats, stats_dma,BIT_0 ); +if (rval !=QLA_SUCCESS ) +ql_log (ql_log_warn, vha,0x70de , +"Resetting ISP statistics failed: rval = %d\n" , + rval);dma_free_coherent (&ha->pdev->dev,sizeof (*stats), stats, stats_dma);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 27/57 scsi: qla2xxx: Fix use after free in bsg
In reply to Sasha LevinFrom: Quinn Tran <[email protected]>
[ Upstream commit 2ce35c0821afc2acd5ee1c3f60d149f8b2520ce8 ]
On bsg command completion, bsg_job_done() was called while qla driver continued to access the bsg_job buffer. bsg_job_done() would free up resources that ended up being reused by other task while the driver continued to access the buffers. As a result, driver was reading garbage data.
localhost kernel: BUG: KASAN: use-after-free in sg_next+0x64/0x80 localhost kernel: Read of size 8 at addr ffff8883228a3330 by task swapper/26/0 localhost kernel:
localhost kernel: CPU: 26 PID: 0 Comm: swapper/26 Kdump:
loaded Tainted: G OE --------- - - 4.18.0-193.el8.x86_64+debug #1
localhost kernel: Hardware name: HP ProLiant DL360
Gen9/ProLiant DL360 Gen9, BIOS P89 08/12/2016
localhost kernel: Call Trace:
localhost kernel: <IRQ>
localhost kernel: dump_stack+0x9a/0xf0
localhost kernel: print_address_description.cold.3+0x9/0x23b localhost kernel: kasan_report.cold.4+0x65/0x95
localhost kernel: debug_dma_unmap_sg.part.12+0x10d/0x2d0 localhost kernel: qla2x00_bsg_sp_free+0xaf6/0x1010 [qla2xxx]
--- drivers/scsi/qla2xxx/qla_bsg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_bsg.c +2 -1
@@ -17,10 +17,11 @@ void qla2x00_bsg_job_done(srb_t *sp, int res)struct bsg_job *bsg_job = sp->u.bsg_job;struct fc_bsg_reply *bsg_reply = bsg_job->reply; + sp->free (sp); + bsg_reply->result = res;bsg_job_done (bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); - sp->free (sp); }void qla2x00_bsg_sp_free (srb_t *sp)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 30/57 scsi: smartpqi: Correct request leakage during reset operations
In reply to Sasha LevinFrom: Murthy Bhat <[email protected]>
[ Upstream commit b622a601a13ae5974c5b0aeecb990c224b8db0d9 ]
While failing queued I/Os in TMF path, there was a request leak and hence stale entries in request pool with ref count being non-zero. In shutdown path we have a BUG_ON to catch stuck I/O either in firmware or in the driver. The stale requests caused a system crash. The I/O request pool leakage also lead to a significant performance drop.
--- drivers/scsi/smartpqi/smartpqi_init.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/smartpqi/smartpqi_init.c +4 -0
@@ -5513,6 +5513,8 @@ static void pqi_fail_io_queued_for_device(struct pqi_ctrl_info *ctrl_info,list_del (&io_request->request_list_entry);set_host_byte (scmd,DID_RESET ); +pqi_free_io_request (io_request); +scsi_dma_unmap (scmd);pqi_scsi_done (scmd); }
@@ -5549,6 +5551,8 @@ static void pqi_fail_io_queued_for_all_devices(struct pqi_ctrl_info *ctrl_info)list_del (&io_request->request_list_entry);set_host_byte (scmd,DID_RESET ); +pqi_free_io_request (io_request); +scsi_dma_unmap (scmd);pqi_scsi_done (scmd); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 31/57 scsi: smartpqi: Add new PCI IDs
In reply to Sasha LevinFrom: Kevin Barnett <[email protected]>
[ Upstream commit 75fbeacca3ad30835e903002dba98dd909b4dfff ]
Add support for newer hardware.
--- drivers/scsi/smartpqi/smartpqi_init.c | 156 ++++++++++++++++++++++++++ 1 file changed, 156 insertions(+)
drivers/scsi/smartpqi/smartpqi_init.c +156 -0
@@ -8146,6 +8146,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x152d ,0x8a37 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x193d ,0x8460 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x193d ,0x1104 )
@@ -8218,6 +8222,22 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x1bd4 ,0x004f ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1bd4 ,0x0051 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1bd4 ,0x0052 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1bd4 ,0x0053 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1bd4 ,0x0054 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x19e5 ,0xd227 )
@@ -8374,6 +8394,122 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_ADAPTEC2 ,0x1380 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1400 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1402 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1410 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1411 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1412 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1420 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1430 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1440 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1441 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1450 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1452 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1460 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1461 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1462 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1470 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1471 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1472 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1480 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1490 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1491 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14a0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14a1 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14b0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14b1 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14c0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14c1 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14d0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14e0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14f0 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_ADVANTECH ,0x8312 )
@@ -8438,6 +8574,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_HP ,0x1001 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_HP ,0x1002 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_HP ,0x1100 )
@@ -8446,6 +8586,22 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_HP ,0x1101 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1590 ,0x0294 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1590 ,0x02db ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1590 ,0x02dc ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1590 ,0x032e ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x1d8d ,0x0800 )
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 32/57 scsi: scsi_dh_alua: Remove check for ASC 24h in alua_rtpg()
In reply to Sasha LevinFrom: "Ewan D. Milne" <[email protected]>
[ Upstream commit bc3f2b42b70eb1b8576e753e7d0e117bbb674496 ]
Some arrays return ILLEGAL_REQUEST with ASC 00h if they don't support the RTPG extended header so remove the check for INVALID FIELD IN CDB.
--- drivers/scsi/device_handler/scsi_dh_alua.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +3 -2
@@ -565,10 +565,11 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)* even though it shouldn't according to T10. * The retry without rtpg_ext_hdr_req set * handles this. +* Note: some arrays return a sense key of ILLEGAL_REQUEST +* with ASC 00h if they don't support the extended header. */ if (!(pg->flags &ALUA_RTPG_EXT_HDR_UNSUPP ) && - sense_hdr.sense_key ==ILLEGAL_REQUEST && - sense_hdr.asc ==0x24 && sense_hdr.ascq ==0 ) { + sense_hdr.sense_key ==ILLEGAL_REQUEST ) { pg->flags |=ALUA_RTPG_EXT_HDR_UNSUPP ; goto retry; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 52/57 scsi: lpfc: Fix crash when a REG_RPI mailbox fails triggering a LOGO response
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit fffd18ec6579c2d9c72b212169259062fe747888 ]
Fix a crash caused by a double put on the node when the driver completed an ACC for an unsolicted abort on the same node. The second put was executed by lpfc_nlp_not_used() and is wrong because the completion routine executes the nlp_put when the iocbq was released. Additionally, the driver is issuing a LOGO then immediately calls lpfc_nlp_set_state to put the node into NPR. This call does nothing.
Remove the lpfc_nlp_not_used call and additional set_state in the completion routine. Remove the lpfc_nlp_set_state post issue_logo. Isn't necessary.
--- drivers/scsi/lpfc/lpfc_nportdisc.c | 2 -- drivers/scsi/lpfc/lpfc_sli.c | 1 - 2 files changed, 3 deletions(-)
drivers/scsi/lpfc/lpfc_nportdisc.c +0 -2
@@ -1961,8 +1961,6 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, ndlp->nlp_last_elscmd =ELS_CMD_PLOGI ;lpfc_issue_els_logo (vport, ndlp,0 ); - ndlp->nlp_prev_state =NLP_STE_REG_LOGIN_ISSUE ; -lpfc_nlp_set_state (vport, ndlp,NLP_STE_NPR_NODE );return ndlp->nlp_state; }
drivers/scsi/lpfc/lpfc_sli.c +0 -1
@@ -17472,7 +17472,6 @@ lpfc_sli4_seq_abort_rsp_cmpl(struct lpfc_hba *phba,if (cmd_iocbq) { ndlp = (struct lpfc_nodelist *)cmd_iocbq->context1;lpfc_nlp_put (ndlp); -lpfc_nlp_not_used (ndlp);lpfc_sli_release_iocbq (phba, cmd_iocbq); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 53/57 scsi: lpfc: Fix error handling for mailboxes completed in MBX_POLL mode
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 304ee43238fed517faa123e034b593905b8679f8 ]
In SLI-4, when performing a mailbox command with MBX_POLL, the driver uses the BMBX register to send the command rather than the MQ. A flag is set indicating the BMBX register is active and saves the mailbox job struct (mboxq) in the mbox_active element of the adapter. The routine then waits for completion or timeout. The mailbox job struct is not freed by the routine. In cases of timeout, the adapter will be reset. The lpfc_sli_mbox_sys_flush() routine will clean up the mbox in preparation for the reset. It clears the BMBX active flag and marks the job structure as MBX_NOT_FINISHED. But, it never frees the mboxq job structure. Expectation in both normal completion and timeout cases is that the issuer of the mbx command will free the structure. Unfortunately, not all calling paths are freeing the memory in cases of error.
All calling paths were looked at and updated, if missing, to free the mboxq memory regardless of completion status.
--- drivers/scsi/lpfc/lpfc_attr.c | 75 +++++++++++++++++++++-------------- drivers/scsi/lpfc/lpfc_init.c | 9 ++--- drivers/scsi/lpfc/lpfc_sli.c | 42 ++++++++++---------- 3 files changed, 70 insertions(+), 56 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +45 -30
@@ -1691,8 +1691,7 @@ lpfc_set_trunking(struct lpfc_hba *phba, char *buff_out)lpfc_printf_log (phba,KERN_ERR ,LOG_MBOX ,"0071 Set trunk mode failed with status: %d" , rc); -if (rc !=MBX_TIMEOUT ) -mempool_free (mbox, phba->mbox_mem_pool); +mempool_free (mbox, phba->mbox_mem_pool);return 0 ; }
@@ -6608,15 +6607,19 @@ lpfc_get_stats(struct Scsi_Host *shost) pmboxq->ctx_buf =NULL ; pmboxq->vport = vport; -if (vport->fc_flag &FC_OFFLINE_MODE ) +if (vport->fc_flag &FC_OFFLINE_MODE ) { rc =lpfc_sli_issue_mbox (phba, pmboxq,MBX_POLL ); -else - rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); - -if (rc !=MBX_SUCCESS ) { -if (rc !=MBX_TIMEOUT ) +if (rc !=MBX_SUCCESS ) {mempool_free (pmboxq, phba->mbox_mem_pool); -return NULL ; +return NULL ; + } + }else { + rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); +if (rc !=MBX_SUCCESS ) { +if (rc !=MBX_TIMEOUT ) +mempool_free (pmboxq, phba->mbox_mem_pool); +return NULL ; + } }memset (hs,0 ,sizeof (struct fc_host_statistics ));
@@ -6640,15 +6643,19 @@ lpfc_get_stats(struct Scsi_Host *shost) pmboxq->ctx_buf =NULL ; pmboxq->vport = vport; -if (vport->fc_flag &FC_OFFLINE_MODE ) +if (vport->fc_flag &FC_OFFLINE_MODE ) { rc =lpfc_sli_issue_mbox (phba, pmboxq,MBX_POLL ); -else - rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); - -if (rc !=MBX_SUCCESS ) { -if (rc !=MBX_TIMEOUT ) +if (rc !=MBX_SUCCESS ) {mempool_free (pmboxq, phba->mbox_mem_pool); -return NULL ; +return NULL ; + } + }else { + rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); +if (rc !=MBX_SUCCESS ) { +if (rc !=MBX_TIMEOUT ) +mempool_free (pmboxq, phba->mbox_mem_pool); +return NULL ; + } } hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt;
@@ -6721,15 +6728,19 @@ lpfc_reset_stats(struct Scsi_Host *shost) pmboxq->vport = vport;if ((vport->fc_flag &FC_OFFLINE_MODE ) || - (!(psli->sli_flag &LPFC_SLI_ACTIVE ))) + (!(psli->sli_flag &LPFC_SLI_ACTIVE ))) { rc =lpfc_sli_issue_mbox (phba, pmboxq,MBX_POLL ); -else - rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); - -if (rc !=MBX_SUCCESS ) { -if (rc !=MBX_TIMEOUT ) +if (rc !=MBX_SUCCESS ) {mempool_free (pmboxq, phba->mbox_mem_pool); -return ; +return ; + } + }else { + rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); +if (rc !=MBX_SUCCESS ) { +if (rc !=MBX_TIMEOUT ) +mempool_free (pmboxq, phba->mbox_mem_pool); +return ; + } }memset (pmboxq,0 ,sizeof (LPFC_MBOXQ_t));
@@ -6739,15 +6750,19 @@ lpfc_reset_stats(struct Scsi_Host *shost) pmboxq->vport = vport;if ((vport->fc_flag &FC_OFFLINE_MODE ) || - (!(psli->sli_flag &LPFC_SLI_ACTIVE ))) + (!(psli->sli_flag &LPFC_SLI_ACTIVE ))) { rc =lpfc_sli_issue_mbox (phba, pmboxq,MBX_POLL ); -else +if (rc !=MBX_SUCCESS ) { +mempool_free (pmboxq, phba->mbox_mem_pool); +return ; + } + }else { rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); - -if (rc !=MBX_SUCCESS ) { -if (rc !=MBX_TIMEOUT ) -mempool_free ( pmboxq, phba->mbox_mem_pool); -return ; +if (rc !=MBX_SUCCESS ) { +if (rc !=MBX_TIMEOUT ) +mempool_free (pmboxq, phba->mbox_mem_pool); +return ; + } } lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt;
drivers/scsi/lpfc/lpfc_init.c +3 -6
@@ -9387,8 +9387,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba)"3250 QUERY_FW_CFG mailbox failed with status " "x%x add_status x%x, mbx status x%x\n" , shdr_status, shdr_add_status, rc); -if (rc !=MBX_TIMEOUT ) -mempool_free (mboxq, phba->mbox_mem_pool); +mempool_free (mboxq, phba->mbox_mem_pool); rc = -ENXIO ; goto out_error; }
@@ -9404,8 +9403,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba)"ulp1_mode:x%x\n" , phba->sli4_hba.fw_func_mode, phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); -if (rc !=MBX_TIMEOUT ) -mempool_free (mboxq, phba->mbox_mem_pool); +mempool_free (mboxq, phba->mbox_mem_pool);/* * Set up HBA Event Queues (EQs)
@@ -10001,8 +9999,7 @@ lpfc_pci_function_reset(struct lpfc_hba *phba) shdr_status =bf_get (lpfc_mbox_hdr_status, &shdr->response); shdr_add_status =bf_get (lpfc_mbox_hdr_add_status, &shdr->response); -if (rc !=MBX_TIMEOUT ) -mempool_free (mboxq, phba->mbox_mem_pool); +mempool_free (mboxq, phba->mbox_mem_pool);if (shdr_status || shdr_add_status || rc) {lpfc_printf_log (phba,KERN_ERR ,LOG_INIT , "0495 SLI_FUNCTION_RESET mailbox "
drivers/scsi/lpfc/lpfc_sli.c +22 -20
90 lines not on this page · raw message
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 33/57 media: em28xx: fix memory leak
In reply to Sasha LevinFrom: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 0ae10a7dc8992ee682ff0b1752ff7c83d472eef1 ]
If some error occurs, URB buffers should also be freed. If they aren't freed with the dvb here, the em28xx_dvb_fini call doesn't frees the URB buffers as dvb is set to NULL. The function in which error occurs should do all the cleanup for the allocations it had done.
Tested the patch with the reproducer provided by syzbot. This patch fixes the memleak.
--- drivers/media/usb/em28xx/em28xx-dvb.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/em28xx/em28xx-dvb.c +1 -0
@@ -1924,6 +1924,7 @@ static int em28xx_dvb_init(struct em28xx *dev)return result; out_free: +em28xx_uninit_usb_xfer (dev,EM28XX_DIGITAL_MODE );kfree (dvb); dev->dvb =NULL ; goto ret;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 34/57 media: vivid: update EDID
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit 443ec4bbc6116f6f492a7a1282bfd8422c862158 ]
The EDID had a few mistakes as reported by edid-decode:
Block 1, CTA-861 Extension Block:
Video Data Block: For improved preferred timing interoperability, set 'Native detailed modes' to 1. Video Capability Data Block: S_PT is equal to S_IT and S_CE, so should be set to 0 instead.
Fixed those.
--- drivers/media/platform/vivid/vivid-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/vivid/vivid-core.c +3 -3
@@ -174,13 +174,13 @@ static const u8 vivid_hdmi_edid[256] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x01 ,0x7b , -0x02 ,0x03 ,0x3f ,0xf0 ,0x51 ,0x61 ,0x60 ,0x5f , +0x02 ,0x03 ,0x3f ,0xf1 ,0x51 ,0x61 ,0x60 ,0x5f ,0x5e ,0x5d ,0x10 ,0x1f ,0x04 ,0x13 ,0x22 ,0x21 ,0x20 ,0x05 ,0x14 ,0x02 ,0x11 ,0x01 ,0x23 ,0x09 ,0x07 ,0x07 ,0x83 ,0x01 ,0x00 ,0x00 ,0x6d ,0x03 ,0x0c ,0x00 ,0x10 ,0x00 ,0x00 ,0x3c ,0x21 ,0x00 ,0x60 ,0x01 ,0x02 ,0x03 ,0x67 ,0xd8 ,0x5d ,0xc4 , -0x01 ,0x78 ,0x00 ,0x00 ,0xe2 ,0x00 ,0xea ,0xe3 , +0x01 ,0x78 ,0x00 ,0x00 ,0xe2 ,0x00 ,0xca ,0xe3 ,0x05 ,0x00 ,0x00 ,0xe3 ,0x06 ,0x01 ,0x00 ,0x4d ,0xd0 ,0x00 ,0xa0 ,0xf0 ,0x70 ,0x3e ,0x80 ,0x30 , 0x20, 0x35, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00,
@@ -189,7 +189,7 @@ static const u8 vivid_hdmi_edid[256] = {0x00 ,0x00 ,0x1a ,0x1a ,0x1d ,0x00 ,0x80 ,0x51 ,0xd0 ,0x1c ,0x20 ,0x40 ,0x80 ,0x35 ,0x00 ,0xc0 ,0x1c ,0x32 ,0x00 ,0x00 ,0x1c ,0x00 ,0x00 ,0x00 , - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, }; static int vidioc_querycap(struct file *file, void *priv,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 36/57 power: supply: generic-adc-battery: fix possible use-after-free in gab_remove()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit b6cfa007b3b229771d9588970adb4ab3e0487f49 ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/power/supply/generic-adc-battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/generic-adc-battery.c +1 -1
@@ -382,7 +382,7 @@ static int gab_remove(struct platform_device *pdev) }kfree (adc_bat->psy_desc.properties); -cancel_delayed_work (&adc_bat->bat_work); +cancel_delayed_work_sync (&adc_bat->bat_work);return 0 ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 37/57 power: supply: s3c_adc_battery: fix possible use-after-free in s3c_adc_bat_remove()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 68ae256945d2abe9036a7b68af4cc65aff79d5b7 ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/power/supply/s3c_adc_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/s3c_adc_battery.c +1 -1
@@ -394,7 +394,7 @@ static int s3c_adc_bat_remove(struct platform_device *pdev)gpio_free (pdata->gpio_charge_finished); } -cancel_delayed_work (&bat_work); +cancel_delayed_work_sync (&bat_work);if (pdata->exit) pdata->exit ();
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 38/57 media: tc358743: fix possible use-after-free in tc358743_remove()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 6107a4fdf8554a7aa9488bdc835bb010062fa8a9 ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/tc358743.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/tc358743.c +1 -1
@@ -2192,7 +2192,7 @@ static int tc358743_remove(struct i2c_client *client)del_timer_sync (&state->timer);flush_work (&state->work_i2c_poll); } -cancel_delayed_work (&state->delayed_work_enable_hotplug); +cancel_delayed_work_sync (&state->delayed_work_enable_hotplug);cec_unregister_adapter (state->cec_adap);v4l2_async_unregister_subdev (sd);v4l2_device_unregister_subdev (sd);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 39/57 media: adv7604: fix possible use-after-free in adv76xx_remove()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit fa56f5f1fe31c2050675fa63b84963ebd504a5b3 ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/adv7604.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv7604.c +1 -1
@@ -3606,7 +3606,7 @@ static int adv76xx_remove(struct i2c_client *client)io_write (sd,0x6e ,0 );io_write (sd,0x73 ,0 ); -cancel_delayed_work (&state->delayed_work_enable_hotplug); +cancel_delayed_work_sync (&state->delayed_work_enable_hotplug);v4l2_async_unregister_subdev (sd);media_entity_cleanup (&sd->entity);adv76xx_unregister_clients (to_state (sd));
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 40/57 media: i2c: adv7511-v4l2: fix possible use-after-free in adv7511_remove()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 2c9541720c66899adf6f3600984cf3ef151295ad ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/adv7511-v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv7511-v4l2.c +1 -1
@@ -1964,7 +1964,7 @@ static int adv7511_remove(struct i2c_client *client)adv7511_set_isr (sd, false);adv7511_init_setup (sd); -cancel_delayed_work (&state->edid_handler); +cancel_delayed_work_sync (&state->edid_handler);i2c_unregister_device (state->i2c_edid);i2c_unregister_device (state->i2c_cec);i2c_unregister_device (state->i2c_pktmem);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 41/57 media: i2c: tda1997: Fix possible use-after-free in tda1997x_remove()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 7f820ab5d4eebfe2d970d32a76ae496a6c286f0f ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/tda1997x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/tda1997x.c +1 -1
@@ -2804,7 +2804,7 @@ static int tda1997x_remove(struct i2c_client *client)media_entity_cleanup (&sd->entity);v4l2_ctrl_handler_free (&state->hdl);regulator_bulk_disable (TDA1997X_NUM_SUPPLIES , state->supplies); -cancel_delayed_work (&state->delayed_work_enable_hpd); +cancel_delayed_work_sync (&state->delayed_work_enable_hpd);mutex_destroy (&state->page_lock);mutex_destroy (&state->lock);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 42/57 media: i2c: adv7842: fix possible use-after-free in adv7842_remove()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 4a15275b6a18597079f18241c87511406575179a ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/adv7842.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv7842.c +1 -1
@@ -3586,7 +3586,7 @@ static int adv7842_remove(struct i2c_client *client)struct adv7842_state *state =to_state (sd);adv7842_irq_enable (sd, false); -cancel_delayed_work (&state->delayed_work_enable_hotplug); +cancel_delayed_work_sync (&state->delayed_work_enable_hotplug);v4l2_device_unregister_subdev (sd);media_entity_cleanup (&sd->entity);adv7842_unregister_clients (sd);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 43/57 media: platform: sti: Fix runtime PM imbalance in regs_show
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 69306a947b3ae21e0d1cbfc9508f00fec86c7297 ]
pm_runtime_get_sync() will increase the runtime PM counter even it returns an error. Thus a pairing decrement is needed to prevent refcount leak. Fix this by replacing this API with pm_runtime_resume_and_get(), which will not change the runtime PM counter on error.
--- drivers/media/platform/sti/bdisp/bdisp-debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/sti/bdisp/bdisp-debug.c +1 -1
@@ -480,7 +480,7 @@ static int regs_show(struct seq_file *s, void *data)int ret;unsigned int i; - ret =pm_runtime_get_sync (bdisp->dev); + ret =pm_runtime_resume_and_get (bdisp->dev);if (ret <0 ) {seq_puts (s,"Cannot wake up IP\n" );return 0 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 44/57 media: dvb-usb: fix memory leak in dvb_usb_adapter_init
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit b7cd0da982e3043f2eec7235ac5530cb18d6af1d ]
syzbot reported memory leak in dvb-usb. The problem was in invalid error handling in dvb_usb_adapter_init().
for (n = 0; n < d->props.num_adapters; n++) {
....
if ((ret = dvb_usb_adapter_stream_init(adap)) ||
(ret = dvb_usb_adapter_dvb_init(adap, adapter_nrs)) ||
(ret = dvb_usb_adapter_frontend_init(adap))) {
return ret;
}
...
d->num_adapters_initialized++;...
}
In case of error in dvb_usb_adapter_dvb_init() or dvb_usb_adapter_dvb_init() d->num_adapters_initialized won't be incremented, but dvb_usb_adapter_exit() relies on it:
for (n = 0; n < d->num_adapters_initialized; n++)
So, allocated objects won't be freed.
--- drivers/media/usb/dvb-usb/dvb-usb-init.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/media/usb/dvb-usb/dvb-usb-init.c +16 -4
@@ -79,11 +79,17 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) } } -if ((ret =dvb_usb_adapter_stream_init (adap)) || - (ret =dvb_usb_adapter_dvb_init (adap, adapter_nrs)) || - (ret =dvb_usb_adapter_frontend_init (adap))) { + ret =dvb_usb_adapter_stream_init (adap); +if (ret)return ret; - } + + ret =dvb_usb_adapter_dvb_init (adap, adapter_nrs); +if (ret) + goto dvb_init_err; + + ret =dvb_usb_adapter_frontend_init (adap); +if (ret) + goto frontend_init_err;/* use exclusive FE lock if there is multiple shared FEs */ if (adap->fe_adap[1 ].fe)
@@ -103,6 +109,12 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) }return 0 ; + +frontend_init_err: +dvb_usb_adapter_dvb_exit (adap); +dvb_init_err: +dvb_usb_adapter_stream_exit (adap); +return ret; }static int dvb_usb_adapter_exit (struct dvb_usb_device *d)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 45/57 media: gscpa/stv06xx: fix memory leak
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit 4f4e6644cd876c844cdb3bea2dd7051787d5ae25 ]
For two of the supported sensors the stv06xx driver allocates memory which is stored in sd->sensor_priv. This memory is freed on a disconnect, but if the probe() fails, then it isn't freed and so this leaks memory.
Add a new probe_error() op that drivers can use to free any allocated memory in case there was a probe failure.
Thanks to Pavel Skripkin <[email protected]> for discovering the cause of the memory leak.
--- drivers/media/usb/gspca/gspca.c | 2 ++ drivers/media/usb/gspca/gspca.h | 1 + drivers/media/usb/gspca/stv06xx/stv06xx.c | 9 +++++++++ 3 files changed, 12 insertions(+)
drivers/media/usb/gspca/gspca.c +2 -0
@@ -1576,6 +1576,8 @@ int gspca_dev_probe2(struct usb_interface *intf,#endif v4l2_ctrl_handler_free (gspca_dev->vdev.ctrl_handler);v4l2_device_unregister (&gspca_dev->v4l2_dev); +if (sd_desc->probe_error) + sd_desc->probe_error (gspca_dev);kfree (gspca_dev->usb_buf);kfree (gspca_dev);return ret;
drivers/media/usb/gspca/gspca.h +1 -0
@@ -105,6 +105,7 @@ struct sd_desc {cam_cf_op config;/* called on probe */ cam_op init;/* called on probe and resume */ cam_op init_controls;/* called on probe */ +cam_v_op probe_error;/* called if probe failed, do cleanup here */ cam_op start;/* called on stream on after URBs creation */ cam_pkt_op pkt_scan;/* optional operations */
drivers/media/usb/gspca/stv06xx/stv06xx.c +9 -0
@@ -529,12 +529,21 @@ static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,static int stv06xx_config (struct gspca_dev *gspca_dev,const struct usb_device_id *id); +static void stv06xx_probe_error (struct gspca_dev *gspca_dev) +{ +struct sd *sd = (struct sd *)gspca_dev; + +kfree (sd->sensor_priv); + sd->sensor_priv =NULL ; +} +/* sub-driver description */ static const struct sd_desc sd_desc = { .name =MODULE_NAME , .config = stv06xx_config, .init = stv06xx_init, .init_controls = stv06xx_init_controls, + .probe_error = stv06xx_probe_error, .start = stv06xx_start, .stopN = stv06xx_stopN, .pkt_scan = stv06xx_pkt_scan,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 46/57 sched/fair: Ignore percpu threads for imbalance pulls
In reply to Sasha LevinFrom: Lingutla Chandrasekhar <[email protected]>
[ Upstream commit 9bcb959d05eeb564dfc9cac13a59843a4fb2edf2 ]
During load balance, LBF_SOME_PINNED will be set if any candidate task cannot be detached due to CPU affinity constraints. This can result in setting env->sd->parent->sgc->group_imbalance, which can lead to a group being classified as group_imbalanced (rather than any of the other, lower group_type) when balancing at a higher level.
In workloads involving a single task per CPU, LBF_SOME_PINNED can often be set due to per-CPU kthreads being the only other runnable tasks on any given rq. This results in changing the group classification during load-balance at higher levels when in reality there is nothing that can be done for this affinity constraint: per-CPU kthreads, as the name implies, don't get to move around (modulo hotplug shenanigans).
It's not as clear for userspace tasks - a task could be in an N-CPU cpuset with N-1 offline CPUs, making it an "accidental" per-CPU task rather than an intended one. KTHREAD_IS_PER_CPU gives us an indisputable signal which we can leverage here to not set LBF_SOME_PINNED.
Note that the aforementioned classification to group_imbalance (when nothing can be done) is especially problematic on big.LITTLE systems, which have a topology the likes of:
DIE [ ]
MC [ ][ ]
0 1 2 3
L L B B arch_scale_cpu_capacity(L) < arch_scale_cpu_capacity(B)
Here, setting LBF_SOME_PINNED due to a per-CPU kthread when balancing at MC level on CPUs [0-1] will subsequently prevent CPUs [2-3] from classifying the [0-1] group as group_misfit_task when balancing at DIE level. Thus, if CPUs [0-1] are running CPU-bound (misfit) tasks, ill-timed per-CPU kthreads can significantly delay the upgmigration of said misfit tasks. Systems relying on ASYM_PACKING are likely to face similar issues.
--- kernel/sched/fair.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/sched/fair.c +4 -0
@@ -7300,6 +7300,10 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)if (throttled_lb_pair (task_group (p), env->src_cpu, env->dst_cpu))return 0 ; +/* Disregard pcpu kthreads; they are where they need to be. */ +if ((p->flags &PF_KTHREAD ) &&kthread_is_per_cpu (p)) +return 0 ; +if (!cpumask_test_cpu (env->dst_cpu, p->cpus_ptr)) {int cpu;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 54/57 scsi: lpfc: Remove unsupported mbox PORT_CAPABILITIES logic
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit b62232ba8caccaf1954e197058104a6478fac1af ]
SLI-4 does not contain a PORT_CAPABILITIES mailbox command (only SLI-3 does, and SLI-3 doesn't use it), yet there are SLI-4 code paths that have code to issue the command. The command will always fail.
Remove the code for the mailbox command and leave only the resulting "failure path" logic.
--- drivers/scsi/lpfc/lpfc_crtn.h | 3 - drivers/scsi/lpfc/lpfc_hw4.h | 174 +--------------------------------- drivers/scsi/lpfc/lpfc_init.c | 103 +------------------- drivers/scsi/lpfc/lpfc_mbox.c | 36 ------- 4 files changed, 3 insertions(+), 313 deletions(-)
drivers/scsi/lpfc/lpfc_crtn.h +0 -3
@@ -56,9 +56,6 @@ void lpfc_register_new_vport(struct lpfc_hba *, struct lpfc_vport *,void lpfc_unreg_vpi (struct lpfc_hba *,uint16_t ,LPFC_MBOXQ_t *);void lpfc_init_link (struct lpfc_hba *,LPFC_MBOXQ_t *,uint32_t ,uint32_t );void lpfc_request_features (struct lpfc_hba *,struct lpfcMboxq *); -void lpfc_supported_pages (struct lpfcMboxq *); -void lpfc_pc_sli4_params (struct lpfcMboxq *); -int lpfc_pc_sli4_params_get (struct lpfc_hba *,LPFC_MBOXQ_t *);int lpfc_sli4_mbox_rsrc_extent (struct lpfc_hba *,struct lpfcMboxq *,uint16_t ,uint16_t ,bool );int lpfc_get_sli4_parameters (struct lpfc_hba *,LPFC_MBOXQ_t *);
drivers/scsi/lpfc/lpfc_hw4.h +1 -173
198 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +2 -101
127 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_mbox.c +0 -36
@@ -2622,39 +2622,3 @@ lpfc_resume_rpi(struct lpfcMboxq *mbox, struct lpfc_nodelist *ndlp) resume_rpi->event_tag = ndlp->phba->fc_eventTag; } -/** -* lpfc_supported_pages - Initialize the PORT_CAPABILITIES supported pages -* mailbox command. -* @mbox: pointer to lpfc mbox command to initialize. -* -* The PORT_CAPABILITIES supported pages mailbox command is issued to -* retrieve the particular feature pages supported by the port. -**/ -void -lpfc_supported_pages (struct lpfcMboxq *mbox) -{ -struct lpfc_mbx_supp_pages *supp_pages; - -memset (mbox,0 ,sizeof (*mbox)); - supp_pages = &mbox->u.mqe.un.supp_pages; -bf_set (lpfc_mqe_command, &mbox->u.mqe,MBX_PORT_CAPABILITIES ); -bf_set (cpn, supp_pages,LPFC_SUPP_PAGES ); -} - -/** -* lpfc_pc_sli4_params - Initialize the PORT_CAPABILITIES SLI4 Params mbox cmd. -* @mbox: pointer to lpfc mbox command to initialize. -* -* The PORT_CAPABILITIES SLI4 parameters mailbox command is issued to -* retrieve the particular SLI4 features supported by the port. -**/ -void -lpfc_pc_sli4_params (struct lpfcMboxq *mbox) -{ -struct lpfc_mbx_pc_sli4_params *sli4_params; - -memset (mbox,0 ,sizeof (*mbox)); - sli4_params = &mbox->u.mqe.un.sli4_params; -bf_set (lpfc_mqe_command, &mbox->u.mqe,MBX_PORT_CAPABILITIES ); -bf_set (cpn, sli4_params,LPFC_SLI4_PARAMETERS ); -}
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 55/57 mfd: arizona: Fix rumtime PM imbalance on error
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit fe6df2b48043bbe1e852b2320501d3b169363c35 ]
pm_runtime_get_sync() will increase the rumtime PM counter even it returns an error. Thus a pairing decrement is needed to prevent refcount leak. Fix this by replacing this API with pm_runtime_resume_and_get(), which will not change the runtime PM counter on error.
--- drivers/mfd/arizona-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/arizona-irq.c +1 -1
@@ -100,7 +100,7 @@ static irqreturn_t arizona_irq_thread(int irq, void *data)unsigned int val;int ret; - ret =pm_runtime_get_sync (arizona->dev); + ret =pm_runtime_resume_and_get (arizona->dev);if (ret <0 ) {dev_err (arizona->dev,"Failed to resume device: %d\n" , ret);return IRQ_NONE ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 56/57 scsi: libfc: Fix a format specifier
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit 90d6697810f06aceea9de71ad836a8c7669789cd ]
Since the 'mfs' member has been declared as 'u32' in include/scsi/libfc.h, use the %u format specifier instead of %hu. This patch fixes the following clang compiler warning:
warning: format specifies type
'unsigned short' but the argument has type 'u32' (aka 'unsigned int')
[-Wformat]
"lport->mfs:%hu\n", mfs, lport->mfs);
~~~ ^~~~~~~~~~
%u--- drivers/scsi/libfc/fc_lport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libfc/fc_lport.c +1 -1
@@ -1729,7 +1729,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,if (mfs <FC_SP_MIN_MAX_PAYLOAD || mfs >FC_SP_MAX_MAX_PAYLOAD ) {FC_LPORT_DBG (lport,"FLOGI bad mfs:%hu response, " -"lport->mfs:%hu\n" , mfs, lport->mfs); +"lport->mfs:%u\n" , mfs, lport->mfs);fc_lport_error (lport, fp); goto out; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 57/57 s390/archrandom: add parameter check for s390_arch_random_generate
In reply to Sasha LevinFrom: Harald Freudenberger <[email protected]>
[ Upstream commit 28096067686c5a5cbd4c35b079749bd805df5010 ]
A review of the code showed, that this function which is exposed within the whole kernel should do a parameter check for the amount of bytes requested. If this requested bytes is too high an unsigned int overflow could happen causing this function to try to memcpy a really big memory chunk.
This is not a security issue as there are only two invocations of this function from arch/s390/include/asm/archrandom.h and both are not exposed to userland.
--- arch/s390/crypto/arch_random.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/s390/crypto/arch_random.c +4 -0
@@ -53,6 +53,10 @@ static DECLARE_DELAYED_WORK(arch_rng_work, arch_rng_refill_buffer);bool s390_arch_random_generate (u8 *buf,unsigned int nbytes) { +/* max hunk is ARCH_RNG_BUF_SIZE */ +if (nbytes >ARCH_RNG_BUF_SIZE ) +return false; +/* lock rng buffer */ if (!spin_trylock (&arch_rng_lock))return false;
Signature · 1 line
2.30.2