aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2025-12-10 21:56:14 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2025-12-10 21:56:14 +0000
commita8d8bf4affa95d3939442a65ea5c8f73785903e5 (patch)
tree78f4b003cb1a080ea4ecdf0f6c09ec35de9af6ed
parent45b3846ae5aa941fa241e9417d5877a94b5c4ba4 (diff)
sendfile: if sendfile_getobj() fails jump to the function epilogue
The functional change here is that *sent would be zeroed. Note that some portable applications, e.g. OpenSSL, use a wrapper around our sendfile(2) to make it more Linux-like. These wrappers are usually written in a manner that expects *sbytes to always be initialized regardless of the error code returned.
-rw-r--r--sys/kern/kern_sendfile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c
index 7ffb09c58b9c..6e924f70b2ab 100644
--- a/sys/kern/kern_sendfile.c
+++ b/sys/kern/kern_sendfile.c
@@ -735,7 +735,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
error = sendfile_getobj(td, fp, &obj, &vp, &shmfd, &obj_size, &bsize);
if (error != 0)
- return (error);
+ goto out;
error = sendfile_getsock(td, sockfd, &sock_fp, &so);
if (error != 0)