Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0079fd9f authored by Sravan Muppidi's avatar Sravan Muppidi
Browse files

msm: camera: core: Avoid concurrency between stop and pfdump



Camera context layer checks the state of the driver context and
allow the events to proceed. Two events should not execute
concurrently on context. Currently Dumping platform data
executing concurrently with flush or stop.
This changes avoid the concurrent execute of dump pf data and other events.
Added validation check in cam_context_config_dev_to_hw.

CRs-Fixed: 2602229
Change-Id: Ib5aaff0edbd39dd63e7eb1c38207f765da294817
Signed-off-by: default avatarSravan Muppidi <muppidi@codeaurora.org>
parent 299c1a13
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/slab.h>
@@ -268,6 +268,7 @@ int cam_context_dump_pf_info(struct cam_context *ctx, unsigned long iova,
		return -EINVAL;
	}

	mutex_lock(&ctx->ctx_mutex);
	if ((ctx->state > CAM_CTX_AVAILABLE) &&
		(ctx->state < CAM_CTX_STATE_MAX)) {
		if (ctx->state_machine[ctx->state].pagefault_ops) {
@@ -278,6 +279,7 @@ int cam_context_dump_pf_info(struct cam_context *ctx, unsigned long iova,
				ctx->dev_hdl, ctx->state);
		}
	}
	mutex_unlock(&ctx->ctx_mutex);

	return rc;
}
+8 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/debugfs.h>
@@ -296,6 +296,13 @@ int32_t cam_context_config_dev_to_hw(
		return rc;
	}

	if ((len < sizeof(struct cam_packet)) ||
		(cmd->offset >= (len - sizeof(struct cam_packet)))) {
		CAM_ERR(CAM_CTXT, "Not enough buf, len : %zu offset = %llu",
			len, cmd->offset);
		return -EINVAL;

	}
	packet = (struct cam_packet *) ((uint8_t *)packet_addr +
		(uint32_t)cmd->offset);