From nobody Tue Jan 2 00:37:34 2024 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 4T3v7y2RS0z55ydg; Tue, 2 Jan 2024 00:37:34 +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 4T3v7y1frbz3J4H; Tue, 2 Jan 2024 00:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704155854; 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=0DndajV0UraSmFve/lQo67MtgLDC+6gJQYAjePsk49c=; b=HPDdM+u1Audw2lpgh+g4AjoRbqoQxCc5HkVYtNKi9cA6hDEKIkUrSGwOROwL4neVy6bMnh LoPKTssi7G1Zy76vHYk47LAQQAxFK5ckabyOopb9I+aaTdqcRu7tRQJzSsDsxr2kbFLQyN Fu/DF5DYvZGwJvnNDI0u+UVjR1lap5rwzC1RmELQtXboe6g2J4TXHhVhJnJtH9Wh6iVqRh IYtIzST6uoJLhIjqeiddQOIIJs+nf8g5b0BtnT32N0x8pha0RLWpLyzaB30u5bthcdaO2T WkBMv4ZUyJgJpQgLQ97xNp8D31JCSJbHPmRBli6LdGfLfKw07Wm5Lqa3fMJ9Fg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704155854; a=rsa-sha256; cv=none; b=li/9RSI4fms6dKzZhZcLrVwrtHFYT3PusDLLXbaf49zwZ6cMYaiApCCqowus6wReqKSXMn N8RFz3A1flmoLBDuDqvVY9ATNIYiNBzverH+hUuhdfnRxO0PdtPGGEW4I7aX+/WZEJMhvD 2GJ4DVKdTCgMbNlIzXLyVYVZLy7emtWl+KmOqlDGp6Pb7wyd9O7yVUuroa0+XWiRgKa7gs Bj64SiM8dAI3SvDT9wl+58pTMBLzqNCcm+F4KCGWVT4TdwtDIrHmxo0ZM04ggsXc6HCXBl FFHxZec8U6nK3XW2ljHO/B6vRkwg9wSHvtl+AFnVft7j47kN8Qs9NO0OPiTlTw== 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=1704155854; 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=0DndajV0UraSmFve/lQo67MtgLDC+6gJQYAjePsk49c=; b=qsj6ypUtcAJJGyS6KKvaUOlz+9FzETWeGOk0QPbYU3VhlUVFCMYdS7KB14LmKQLxGB4cuA nVHgKMNGhbgx6m6zoDZKDGKCSfQ71KwKWNMIVmFh3KPrtCdhPSLMkokcmOuI9fWAErYA1Q h6XW6D5A97G8ip36DVyUj8ZP1WYkX+A1U2FkTkGugpHgZlug7phi/UWD35zwxOb1VfrePG N0iC6UcvaAHS+Tau5tgxPzOt9ndGVRhH5MuuZwW8rl9D4nu3cjlQzSHHue0IMTlI/oSMUk l+TDZ5ldVhlh/sHbNo2yqVcD5iMw3PpydRJAhqRJLFoKnOzgyRzDksz32Y5lzg== 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 4T3v7y0mchzfbF; Tue, 2 Jan 2024 00:37:34 +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 4020bYBi085893; Tue, 2 Jan 2024 00:37:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4020bY4O085890; Tue, 2 Jan 2024 00:37:34 GMT (envelope-from git) Date: Tue, 2 Jan 2024 00:37:34 GMT Message-Id: <202401020037.4020bY4O085890@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9b28f3f03236 - stable/14 - iscsi: Check for copyout errors in iscsi_ioctl_daemon_receive() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9b28f3f0323645960404c5e61e4ded5468910d72 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9b28f3f0323645960404c5e61e4ded5468910d72 commit 9b28f3f0323645960404c5e61e4ded5468910d72 Author: Mark Johnston AuthorDate: 2023-12-26 01:43:31 +0000 Commit: Mark Johnston 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 */