Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jan 2024 00:37:34 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9b28f3f03236 - stable/14 - iscsi: Check for copyout errors in iscsi_ioctl_daemon_receive()
Message-ID:  <202401020037.4020bY4O085890@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=9b28f3f0323645960404c5e61e4ded5468910d72

commit 9b28f3f0323645960404c5e61e4ded5468910d72
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-26 01:43:31 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-02 00:29:59 +0000

    iscsi: Check for copyout errors in iscsi_ioctl_daemon_receive()
    
    Reviewed by:    jhb
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D43148
    
    (cherry picked from commit 74e713804fa4767991c5f20e6b85da4235107122)
---
 sys/dev/iscsi/iscsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index 38973898a9d1..0a39e94a25cb 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -1897,17 +1897,17 @@ iscsi_ioctl_daemon_receive(struct iscsi_softc *sc,
 		return (EMSGSIZE);
 	}
 
-	copyout(ip->ip_bhs, idr->idr_bhs, sizeof(*ip->ip_bhs));
-	if (ip->ip_data_len > 0) {
+	error = copyout(ip->ip_bhs, idr->idr_bhs, sizeof(*ip->ip_bhs));
+	if (error == 0 && ip->ip_data_len > 0) {
 		data = malloc(ip->ip_data_len, M_ISCSI, M_WAITOK);
 		icl_pdu_get_data(ip, 0, data, ip->ip_data_len);
-		copyout(data, idr->idr_data_segment, ip->ip_data_len);
+		error = copyout(data, idr->idr_data_segment, ip->ip_data_len);
 		free(data, M_ISCSI);
 	}
 
 	icl_pdu_free(ip);
 
-	return (0);
+	return (error);
 }
 #endif /* ICL_KERNEL_PROXY */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401020037.4020bY4O085890>