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

Commit 2fc23baf authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipaut: Do not use kernel file object after write fop returns"

parents b7ff5e84 9016904a
Loading
Loading
Loading
Loading
+14 −22
Original line number Diff line number Diff line
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-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
@@ -48,12 +48,14 @@ struct ipa_ut_context {

/**
 * struct ipa_ut_dbgfs_test_write_work_ctx - work_queue context
 * @dbgfs: work_struct for the write_work
 * @file: file  to be writen to
 * @dbgfs_Work: work_struct for the write_work
 * @meta_type: See enum ipa_ut_meta_test_type
 * @user_data: user data usually used to point to suite or test object
 */
struct ipa_ut_dbgfs_test_write_work_ctx {
	struct work_struct dbgfs_work;
	struct file *file;
	long meta_type;
	void *user_data;
};

static ssize_t ipa_ut_dbgfs_enable_read(struct file *file,
@@ -218,7 +220,6 @@ static void ipa_ut_dbgfs_meta_test_write_work_func(struct work_struct *work)
{
	struct ipa_ut_dbgfs_test_write_work_ctx *write_work_ctx;
	struct ipa_ut_suite *suite;
	struct file *file;
	int i;
	enum ipa_hw_type ipa_ver;
	int rc = 0;
@@ -231,14 +232,9 @@ static void ipa_ut_dbgfs_meta_test_write_work_func(struct work_struct *work)
	IPA_UT_DBG("Entry\n");

	mutex_lock(&ipa_ut_ctx->lock);
	file = write_work_ctx->file;
	if (file == NULL) {
		rc = -EFAULT;
		goto unlock_mutex;
	}
	suite = file->f_inode->i_private;
	suite = (struct ipa_ut_suite *)(write_work_ctx->user_data);
	ipa_assert_on(!suite);
	meta_type = (long)(file->private_data);
	meta_type = write_work_ctx->meta_type;
	IPA_UT_DBG("Meta test type %ld\n", meta_type);

	_IPA_UT_TEST_LOG_BUF_NAME = kzalloc(_IPA_UT_TEST_LOG_BUF_SIZE,
@@ -353,7 +349,7 @@ static void ipa_ut_dbgfs_meta_test_write_work_func(struct work_struct *work)
}

/*
 * ipa_ut_dbgfs_meta_test_write() - Debugfs write func for a for a meta test
 * ipa_ut_dbgfs_meta_test_write() - Debugfs write func for a meta test
 * @params: write fops
 *
 * Run all tests in a suite using a work queue so it does not race with
@@ -372,7 +368,8 @@ static ssize_t ipa_ut_dbgfs_meta_test_write(struct file *file,
		return -ENOMEM;
	}

	write_work_ctx->file = file;
	write_work_ctx->user_data = file->f_inode->i_private;
	write_work_ctx->meta_type = (long)(file->private_data);

	INIT_WORK(&write_work_ctx->dbgfs_work,
		ipa_ut_dbgfs_meta_test_write_work_func);
@@ -514,7 +511,6 @@ static void ipa_ut_dbgfs_test_write_work_func(struct work_struct *work)
	struct ipa_ut_dbgfs_test_write_work_ctx *write_work_ctx;
	struct ipa_ut_test *test;
	struct ipa_ut_suite *suite;
	struct file *file;
	bool tst_fail = false;
	int rc = 0;
	enum ipa_hw_type ipa_ver;
@@ -525,12 +521,7 @@ static void ipa_ut_dbgfs_test_write_work_func(struct work_struct *work)
	IPA_UT_DBG("Entry\n");

	mutex_lock(&ipa_ut_ctx->lock);
	file = write_work_ctx->file;
	if (file == NULL) {
		rc = -EFAULT;
		goto unlock_mutex;
	}
	test = file->f_inode->i_private;
	test = (struct ipa_ut_test *)(write_work_ctx->user_data);
	ipa_assert_on(!test);

	_IPA_UT_TEST_LOG_BUF_NAME = kzalloc(_IPA_UT_TEST_LOG_BUF_SIZE,
@@ -632,7 +623,8 @@ static ssize_t ipa_ut_dbgfs_test_write(struct file *file,
		return -ENOMEM;
	}

	write_work_ctx->file = file;
	write_work_ctx->user_data = file->f_inode->i_private;
	write_work_ctx->meta_type = (long)(file->private_data);

	INIT_WORK(&write_work_ctx->dbgfs_work,
		ipa_ut_dbgfs_test_write_work_func);