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

Commit 7946d14c authored by android-t1's avatar android-t1
Browse files

[FP4-3860]Integrate security patch CVE_2021_30337

Change-Id: I84cd66fcf1fd7e9ad852c7d05b21c2ee7d6ec1dc
parent 748071cb
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -415,6 +415,7 @@ struct fastrpc_mmap {
	int uncached;
	int secure;
	uintptr_t attr;
	bool is_filemap; /*flag to indicate map used in process init*/
};

enum fastrpc_perfkeys {
@@ -834,9 +835,10 @@ static int fastrpc_mmap_remove(struct fastrpc_file *fl, uintptr_t va,

	spin_lock(&me->hlock);
	hlist_for_each_entry_safe(map, n, &me->maps, hn) {
		if (map->raddr == va &&
		if (map->refs == 1 && map->raddr == va &&
			map->raddr + map->len == va + len &&
			map->refs == 1) {
            /*Remove map if not used in process initialization*/
                       !map->is_filemap) {
			match = map;
			hlist_del_init(&map->hn);
			break;
@@ -848,9 +850,10 @@ static int fastrpc_mmap_remove(struct fastrpc_file *fl, uintptr_t va,
		return 0;
	}
	hlist_for_each_entry_safe(map, n, &fl->maps, hn) {
		if (map->raddr == va &&
		if (map->refs == 1 && map->raddr == va &&
			map->raddr + map->len == va + len &&
			map->refs == 1) {
            /*Remove map if not used in process initialization*/
                       !map->is_filemap) {
			match = map;
			hlist_del_init(&map->hn);
			break;
@@ -985,6 +988,7 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
	map->refs = 1;
	map->fl = fl;
	map->fd = fd;
	map->is_filemap = false;
	map->attr = attr;
	if (mflags == ADSP_MMAP_HEAP_ADDR ||
				mflags == ADSP_MMAP_REMOTE_HEAP_ADDR) {
@@ -2587,6 +2591,8 @@ static int fastrpc_init_process(struct fastrpc_file *fl,
			VERIFY(err, !fastrpc_mmap_create(fl, init->filefd, 0,
				init->file, init->filelen, mflags, &file));
			mutex_unlock(&fl->map_mutex);
                       if (file)
                               file->is_filemap = true;
			if (err)
				goto bail;
		}