From nobody Thu Aug 17 19:58:41 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RRbRP4x5Vz4q4tY; Thu, 17 Aug 2023 19:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RRbRP1hyNz4HSR; Thu, 17 Aug 2023 19:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692302321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kbR9EcABJvYpsO776hoyaHuG5DqZ2HQ4mxtLzGd/1qY=; b=e8NFt4Gq3kRScByK1iOABKu3gMX1Mvnkwxc0eVA/ZFm/vUvYSmN7VgBRwwDc9F+e3qFlq6 iTo3Uytzip4++7JxZuMOj2HA8IgWWFU9LYdog/qUQCHVdAYr5I6+nSgoLojItOxMjZLL4G v+YVm6dm3x3ztvorsgWJYcXbOl0L1ITXSAgw+oHoMK1xssfMfKt+sueuD1fsniBzkXBGOL tmUYwTHrrhKWUaWy5H798ixOORro9T2l2kMvyGuB+lfCp/ueOre3LkOVAvf6qIYZqCglq8 vXkwC5aneI88TXcepC/CiujFoNGn7NZQNDL4pCKQ3zWJOxVoTEO+KveH7Q58TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692302321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kbR9EcABJvYpsO776hoyaHuG5DqZ2HQ4mxtLzGd/1qY=; b=wDVw3jjUyWu0q3aQPFzf9YJNMlAgScAShS0phSzxXUQurIwxhwfuVkGSRnqYNl9m/8BnqL HNRhpH9o7fMgG08dDgPAe0g6A8ejkpPElcGLQ7cVci8/DeMb6Nm99F0QFnHae+9owsmSgC b4oOPdcIRSXLzIt0ioJJddb3Y4RFMD5dVh9EFVPazLNkcaSf0IG2/tMtmJO3cAcaDgXdfI fwo2d5CWay5wodYy30Z36fuob3avwLe+L/oAdxkMH2ma0exek7KR+jca58qK1UUHrvcOgs Zi3V3zSGEWYHS1RLNtKvbEKTky8ooXqekL73asUjShbq4wk966rX0bT/fWLObA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692302321; a=rsa-sha256; cv=none; b=RoKOL+I3ipQa1xVRuunaSYb2BCF9YWCvnq33BOSLDK/FKRkroRFV2YP6hIQpJxokXr7K01 VOURrKDFOn8zNy67DHaonc+86yC76aDEnBTRFnY4+gIsqAfOMynxaPCTdOWvxR7yV8yjxG nRvcNPaVpQLG8sx+dQjaHT8TwumhHvdE7VHkckCW5F3ZX9QVfiB8rC/YlYNs1Gf4obDXJd xSBXDzQyW8uz9yzrMJBJBElXuExPoBCVD6P9g527hd7lf1/OzXcWieWnT24sBLMlxgFyGa tz0jk3rbegLFKqidRZTNkAdnFWSVVgskM2NdtU3DNcDqsmTFspBMAXMxLuaBqw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RRbRP0pc3zn63; Thu, 17 Aug 2023 19:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37HJwfB0080481; Thu, 17 Aug 2023 19:58:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37HJwf1b080478; Thu, 17 Aug 2023 19:58:41 GMT (envelope-from git) Date: Thu, 17 Aug 2023 19:58:41 GMT Message-Id: <202308171958.37HJwf1b080478@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 4a521544a683 - main - linux(4): Don't miss error from underlying in sendfile List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a521544a683bd2140dcf596ee571a0f10f52890 Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=4a521544a683bd2140dcf596ee571a0f10f52890 commit 4a521544a683bd2140dcf596ee571a0f10f52890 Author: Dmitry Chagin AuthorDate: 2023-08-17 19:57:17 +0000 Commit: Dmitry Chagin CommitDate: 2023-08-17 19:57:17 +0000 linux(4): Don't miss error from underlying in sendfile MFC after: 1 month --- sys/compat/linux/linux_socket.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index f768392be546..8def4dfaa665 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -2594,7 +2594,6 @@ linux_sendfile(struct thread *td, struct linux_sendfile_args *arg) off_t offset64; l_off_t offset; - int ret; int error; if (arg->offset != NULL) { @@ -2604,10 +2603,10 @@ linux_sendfile(struct thread *td, struct linux_sendfile_args *arg) offset64 = offset; } - ret = linux_sendfile_common(td, arg->out, arg->in, + error = linux_sendfile_common(td, arg->out, arg->in, arg->offset != NULL ? &offset64 : NULL, arg->count); - if (arg->offset != NULL) { + if (error == 0 && arg->offset != NULL) { #if defined(__i386__) || defined(__arm__) || \ (defined(__amd64__) && defined(COMPAT_LINUX32)) if (offset64 > INT32_MAX) @@ -2615,11 +2614,9 @@ linux_sendfile(struct thread *td, struct linux_sendfile_args *arg) #endif offset = (l_off_t)offset64; error = copyout(&offset, arg->offset, sizeof(offset)); - if (error != 0) - return (error); } - return (ret); + return (error); } #if defined(__i386__) || defined(__arm__) || \ @@ -2629,7 +2626,6 @@ int linux_sendfile64(struct thread *td, struct linux_sendfile64_args *arg) { off_t offset; - int ret; int error; if (arg->offset != NULL) { @@ -2638,16 +2634,13 @@ linux_sendfile64(struct thread *td, struct linux_sendfile64_args *arg) return (error); } - ret = linux_sendfile_common(td, arg->out, arg->in, + error = linux_sendfile_common(td, arg->out, arg->in, arg->offset != NULL ? &offset : NULL, arg->count); - if (arg->offset != NULL) { + if (error == 0 && arg->offset != NULL) error = copyout(&offset, arg->offset, sizeof(offset)); - if (error != 0) - return (error); - } - return (ret); + return (error); } /* Argument list sizes for linux_socketcall */