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

Commit f2a39740 authored by Raghavendra Ambadas's avatar Raghavendra Ambadas
Browse files

fbdev: msm: check for valid fence before using objects



Validate the input fence for mdss and sde rotator before
referencing the structure objects.
and also log the fence driver name waiting for the fence.
Earlier the fence name was null irrespective of the
driver.

Change-Id: Ie277d861057a41092505c73ef3815f7d769d114e
Signed-off-by: default avatarRaghavendra Ambadas <quic_c_rambad@quicinc.com>
parent d9e397cf
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -151,6 +152,11 @@ static void sde_rot_fence_release(struct fence *fence)
	struct sde_rot_fence *f = to_sde_rot_fence(fence);
	unsigned long flags;

	if (fence->ops->get_driver_name != &sde_rot_fence_get_driver_name) {
		pr_debug("invalid parameters\n");
		return;
	}

	spin_lock_irqsave(fence->lock, flags);
	if (!list_empty(&f->fence_list))
		list_del(&f->fence_list);
+19 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -131,6 +132,13 @@ static void mdss_fence_release(struct fence *fence)
	struct mdss_timeline *tl = to_mdss_timeline(fence);

	pr_debug("%s for fence %s\n", __func__, f->name);

	if (!fence || (fence->ops->get_driver_name !=
			&mdss_fence_get_driver_name)) {
		pr_debug("invalid parameters\n");
		return;
	}

	spin_lock(&tl->list_lock);
	if (!list_empty(&f->fence_list))
		list_del(&f->fence_list);
@@ -421,7 +429,10 @@ int mdss_wait_sync_fence(struct mdss_fence *fence,
 */
struct mdss_fence *mdss_get_fd_sync_fence(int fd)
{
	return (struct mdss_fence *) sync_file_get_fence(fd);
	struct fence *fence = NULL;

	fence = sync_file_get_fence(fd);
	return to_mdss_fence(fence);
}

/*
@@ -464,11 +475,18 @@ int mdss_get_sync_fence_fd(struct mdss_fence *fence)
 */
const char *mdss_get_sync_fence_name(struct mdss_fence *fence)
{
	struct fence *input_fence = NULL;

	if (!fence) {
		pr_err("invalid parameters\n");
		return NULL;
	}

	input_fence = (struct fence *) &fence->base;

	if (input_fence->ops->get_driver_name != &mdss_fence_get_driver_name)
		return input_fence->ops->get_driver_name(input_fence);

	return fence->name;
}
#endif