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

Commit d7c7e7b3 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "FROMLIST: binder: fix UAF of ref->proc caused by race condition"

parents 8270d4b3 7cdb30b0
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1948,6 +1948,18 @@ static int binder_inc_ref_for_node(struct binder_proc *proc,
	}
	ret = binder_inc_ref_olocked(ref, strong, target_list);
	*rdata = ref->data;
	if (ret && ref == new_ref) {
		/*
		 * Cleanup the failed reference here as the target
		 * could now be dead and have already released its
		 * references by now. Calling on the new reference
		 * with strong=0 and a tmp_refs will not decrement
		 * the node. The new_ref gets kfree'd below.
		 */
		binder_cleanup_ref_olocked(new_ref);
		ref = NULL;
	}

	binder_proc_unlock(proc);
	if (new_ref && ref != new_ref)
		/*