mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
hwpmc: release a PMC whose ID could not be copied out
If copyout of the newly allocated PMC ID fails, the caller cannot use or release the PMC. Release it in the kernel. Reviewed by: mhorne MFC after: 3 days Sponsored by: Advanced Micro Devices, Inc. Differential Revision: https://reviews.freebsd.org/D60562
This commit is contained in:
1 parent
fdfb611461
commit
e5a48c8e0d
1 file changed
+6
@@ -4367,6 +4367,12 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
|
||||
break;
|
||||
|
||||
error = copyout(&pa, arg, sizeof(pa));
|
||||
/*
|
||||
* The caller never learns the ID of an unpublished PMC; do
|
||||
* not leave it (and the row it holds) behind.
|
||||
*/
|
||||
if (error != 0)
|
||||
(void)pmc_do_op_pmcrelease(pa.pm_pmcid);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in new issue
Block a user