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

Commit e782d53f authored by Shubhashree Dhar's avatar Shubhashree Dhar
Browse files

sde: rotator: Add null pointer checks



Pointers in some cases are dereferenced even after
freeing memory region pointed by them. Assign NULL to
free pointers and perform proper NULL pointer checks.

Change-Id: Id9caef8af0c9d06e40e99ed71db68197fc6cf4f4
Signed-off-by: default avatarShubhashree Dhar <dhar@codeaurora.org>
parent 61147a12
Loading
Loading
Loading
Loading
+12 −3
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
@@ -1084,6 +1084,7 @@ struct sde_rotator_ctx *sde_rotator_ctx_open(
	mutex_unlock(&rot_dev->lock);
error_lock:
	kfree(ctx);
	ctx = NULL;
	return ERR_PTR(ret);
}

@@ -1096,10 +1097,18 @@ struct sde_rotator_ctx *sde_rotator_ctx_open(
static int sde_rotator_ctx_release(struct sde_rotator_ctx *ctx,
		struct file *file)
{
	struct sde_rotator_device *rot_dev = ctx->rot_dev;
	u32 session_id = ctx->session_id;
	struct sde_rotator_device *rot_dev;
	u32 session_id;
	struct list_head *curr, *next;

	if (!ctx) {
		SDEROT_DBG("ctx is NULL\n");
		return -EINVAL;
	}

	rot_dev = ctx->rot_dev;
	session_id = ctx->session_id;

	ATRACE_END(ctx->kobj.name);

	SDEDEV_DBG(rot_dev->dev, "release s:%d\n", session_id);