mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-30 13:44:55 +00:00
kern_copy_file_range(): handle rangelock recursion
PR: 281073 Reviewed by: markj Tested by: lwhsu Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D46465
This commit is contained in:
parent
0b6b1c2859
commit
4e1f29b92d
|
@ -4978,11 +4978,13 @@ kern_copy_file_range(struct thread *td, int infd, off_t *inoffp, int outfd,
|
|||
* If infp and outfp refer to the same file, the byte ranges cannot
|
||||
* overlap.
|
||||
*/
|
||||
if (invp == outvp && ((savinoff <= savoutoff && savinoff + len >
|
||||
savoutoff) || (savinoff > savoutoff && savoutoff + len >
|
||||
savinoff))) {
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
if (invp == outvp) {
|
||||
if ((savinoff <= savoutoff && savinoff + len > savoutoff) ||
|
||||
(savinoff > savoutoff && savoutoff + len > savinoff)) {
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
rangelock_may_recurse(&invp->v_rl);
|
||||
}
|
||||
|
||||
/* Range lock the byte ranges for both invp and outvp. */
|
||||
|
|
Loading…
Reference in a new issue