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

Commit 51f1f59a authored by Rajesh Kemisetti's avatar Rajesh Kemisetti Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Fix race condition while making page as dirty



set_page_dirty() is racy if the caller has no
reference against page->mapping->host, and if
the page is unlocked. This is because another
CPU could truncate the page off the mapping and
then free the mapping.

Use set_page_dirty_lock() to avoid this race condition.

Change-Id: I517fb9aee66560618c7676b311368f7a7498011f
Signed-off-by: default avatarRajesh Kemisetti <rajeshk@codeaurora.org>
Signed-off-by: default avatarArchana Sriram <apsrir@codeaurora.org>
parent b1d5c60a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2008-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2008-2019, 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
@@ -328,7 +328,7 @@ kgsl_mem_entry_destroy(struct kref *kref)
			    entry->memdesc.sgt->nents, i) {
			page = sg_page(sg);
			for (j = 0; j < (sg->length >> PAGE_SHIFT); j++)
				set_page_dirty(nth_page(page, j));
				set_page_dirty_lock(nth_page(page, j));
		}
	}