From nobody Fri Dec 22 20:12:41 2023 X-Original-To: dev-commits-src-all@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 4Sxdky2z41z54PlG; Fri, 22 Dec 2023 20:12:42 +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 4Sxdky0h6Yz4LpG; Fri, 22 Dec 2023 20:12:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703275962; 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=7aXCkrP9IaSWCFfqZuoAQ/ll8ASplm/F9PEWDusrzvs=; b=W0L9JoXOElZrhxxrltD1UDVd3TxroKSxtHWp8yVQfj2xcJBu23tnI2B0bdvO27pHRs+k5Q lETjJ7RcU0VZTWCWre/47KiyGjSC2Fw11W/GSHX7hGnl3dHaqeWGb7Hu+0fo9kQRe/l4pP BgXmLidnlFl9oYamwAk3RmvYjD6KZSK+INqkdAZHuPUKw7FjMVrJCKJhtoL3tlsVEo6FNw Hkb7hdcnnQgXC2CItQk3nrEjVMazqDskhPHNjmJsmSR/BbTq2VUsJ07gZGGOOFLZ03taY7 4ve1/VxCgJfp6KaCFQbRuz/FowljB9t6UAHS5oea4Gv5WmlwYgZtXvQYhiOBZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703275962; a=rsa-sha256; cv=none; b=spdCOTuPsp3vzUfkr+J2jmef02I6NBE/tsljkpPDWlCtMpxVDO4r8CsfBh2FMmt7PGaqhD HdtlD60+NC9d4YRSNbEuErTH7UX8Z0jzwOZH6ZTvVykPzRarOItEVsEfi0N1KRUfJORM5P EZsPLf/2SQkUm6TsHU722/hfEK2zPfrL5tsVtIKmz5qsCnosyp4jy2ywiYNZkUZHXj7qtY sd5xlRqJoduONxEiHIbjBu1e0ekEbbyk8AHIDMLQ4Za1v6EurI90w4P+BE5QL3TK+PSDb5 gFbx9sj2w/kIkMCCIePKaoGoTRSjFIPUKhr8EUb+My6+cG6jAkGsBinQ3WHX9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703275962; 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=7aXCkrP9IaSWCFfqZuoAQ/ll8ASplm/F9PEWDusrzvs=; b=kaD8H9+52mI1dmGnR2ERSRSY52qvYk3Ylj7dn6rgRX4NrH18AFofFl8+iCcBEHHxcgQ4Q+ TRJdkCFED5Tvs0iuh6ep61uOcDI1TEVPsaPVMlb1tIpmUKTv48vNc0oeqcejBW1nk9oiIU zR//5KMd3SLrxaFm4XQx/TqQ8EEMIbIVyVHyyu0X+gJwqcVcL2I6PAARER6+MPjSyGA4vs 6+E+z6qFtgJLM55fbcrewjo8hFDQqgvSlet1gMMq+2Axgyzy6LgVTUJVx9WoYRUcivZr44 Lu8Q9QYOlTCRWRxKtvn1oxgZ2axBmJZKWS/ZBty6EsxZ7uYOdHSmh3x+FCPRLw== 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 4Sxdkx6tHnzWGD; Fri, 22 Dec 2023 20:12: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 3BMKCfmX047361; Fri, 22 Dec 2023 20:12:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BMKCfT2047358; Fri, 22 Dec 2023 20:12:41 GMT (envelope-from git) Date: Fri, 22 Dec 2023 20:12:41 GMT Message-Id: <202312222012.3BMKCfT2047358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: b484bcd504a2 - main - nfscl: Fix handling of a copyout() error reply List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b484bcd504a29037752d5214a418412724761d88 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b484bcd504a29037752d5214a418412724761d88 commit b484bcd504a29037752d5214a418412724761d88 Author: Rick Macklem AuthorDate: 2023-12-22 20:11:22 +0000 Commit: Rick Macklem CommitDate: 2023-12-22 20:11:22 +0000 nfscl: Fix handling of a copyout() error reply If vfs.nfs.nfs_directio_enable is set non-zero (the default is zero) and a file on an NFS mount is read after being opened with O_DIRECT | O_ RDONLY, a call to nfsm_mbufuio() calls copyout() without checking for an error return. If copyout() returns EFAULT, this would not work correctly. Only the call path VOP_READ()->ncl_readrpc()->nfsrpc_read()->nfsrpc_readrpc() will do this and the error return for EFAULT will be returned back to VOP_READ(). This patch adds the error check to nfsm_mbufuio(). Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D43160 --- sys/fs/nfs/nfs_commonsubs.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 832713e6c1de..e79f73739487 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -679,17 +679,13 @@ nfsm_mbufuio(struct nfsrv_descript *nd, struct uio *uiop, int siz) ("len %d, corrupted mbuf?", len)); } xfer = (left > len) ? len : left; -#ifdef notdef - /* Not Yet.. */ - if (uiop->uio_iov->iov_op != NULL) - (*(uiop->uio_iov->iov_op)) - (mbufcp, uiocp, xfer); - else -#endif if (uiop->uio_segflg == UIO_SYSSPACE) NFSBCOPY(mbufcp, uiocp, xfer); - else - copyout(mbufcp, uiocp, xfer); + else { + error = copyout(mbufcp, uiocp, xfer); + if (error != 0) + goto out; + } left -= xfer; len -= xfer; mbufcp += xfer;