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

Commit 3f0e1c0e authored by Abhinav Kumar's avatar Abhinav Kumar Committed by Gerrit - the friendly Code Review server
Browse files

drivers/misc: add protection for probe order changes



HDCP driver can get probed before the SDE driver causing
empty device handles to be stored in the device related
structures.

Add protection for such cases by checking the validitiy
of the handle and storing it if necessary.

CRs-Fixed: 2181269
Change-Id: I65d574788900db06e168ba0d4014c575f8f4cda6
Signed-off-by: default avatarAbhinav Kumar <abhinavk@codeaurora.org>
parent c9738304
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2216,13 +2216,24 @@ int hdcp_library_register(struct hdcp_register_data *data)
	}

	*data->hdcp_ctx = handle;
	/* Cache the client ctx to be used later
	 * HDCP driver probe happens earlier than

	/* Cache the client ctx to be used later if
	 * Misc HDCP driver probe happens later than
	 * SDE driver probe hence caching it to
	 * be used later.
	 */

	drv_client_handle = handle;

	/* if misc HDCP driver probe happens earlier
	 * than SDE driver probe store the client
	 * handle to be used to sysfs notifications.
	 */

	if (hdcp_drv_mgr && !hdcp_drv_mgr->handle) {
		if (drv_client_handle)
			hdcp_drv_mgr->handle = drv_client_handle;
	}

	handle->thread = kthread_run(kthread_worker_fn,
				     &handle->worker, "hdcp_tz_lib");