Unverified Commit df85e99b authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15129 comedi: Flush partial mappings in error case

parents 3178f046 c9811b22
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -2402,6 +2402,18 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)


			start += PAGE_SIZE;
			start += PAGE_SIZE;
		}
		}

#ifdef CONFIG_MMU
		/*
		 * Leaving behind a partial mapping of a buffer we're about to
		 * drop is unsafe, see remap_pfn_range_notrack().
		 * We need to zap the range here ourselves instead of relying
		 * on the automatic zapping in remap_pfn_range() because we call
		 * remap_pfn_range() in a loop.
		 */
		if (retval)
			zap_vma_ptes(vma, vma->vm_start, size);
#endif
	}
	}


	if (retval == 0) {
	if (retval == 0) {