Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'powerpc-6.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fix from Madhavan Srinivasan:

- Add close() callback in vas_vm_ops struct for proper cleanup

Thanks to Haren Myneni.

* tag 'powerpc-6.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/pseries/vas: Add close() callback in vas_vm_ops struct

+36
+36
arch/powerpc/platforms/book3s/vas-api.c
··· 464 464 return VM_FAULT_SIGBUS; 465 465 } 466 466 467 + /* 468 + * During mmap() paste address, mapping VMA is saved in VAS window 469 + * struct which is used to unmap during migration if the window is 470 + * still open. But the user space can remove this mapping with 471 + * munmap() before closing the window and the VMA address will 472 + * be invalid. Set VAS window VMA to NULL in this function which 473 + * is called before VMA free. 474 + */ 475 + static void vas_mmap_close(struct vm_area_struct *vma) 476 + { 477 + struct file *fp = vma->vm_file; 478 + struct coproc_instance *cp_inst = fp->private_data; 479 + struct vas_window *txwin; 480 + 481 + /* Should not happen */ 482 + if (!cp_inst || !cp_inst->txwin) { 483 + pr_err("No attached VAS window for the paste address mmap\n"); 484 + return; 485 + } 486 + 487 + txwin = cp_inst->txwin; 488 + /* 489 + * task_ref.vma is set in coproc_mmap() during mmap paste 490 + * address. So it has to be the same VMA that is getting freed. 491 + */ 492 + if (WARN_ON(txwin->task_ref.vma != vma)) { 493 + pr_err("Invalid paste address mmaping\n"); 494 + return; 495 + } 496 + 497 + mutex_lock(&txwin->task_ref.mmap_mutex); 498 + txwin->task_ref.vma = NULL; 499 + mutex_unlock(&txwin->task_ref.mmap_mutex); 500 + } 501 + 467 502 static const struct vm_operations_struct vas_vm_ops = { 503 + .close = vas_mmap_close, 468 504 .fault = vas_mmap_fault, 469 505 }; 470 506