lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 19 Aug 2019 04:33:41 +0000
From:   Ben Wei <benwei@...com>
To:     Ben Wei <benwei@...com>
CC:     "openbmc@...ts.ozlabs.org" <openbmc@...ts.ozlabs.org>,
        "Samuel Mendoza-Jonas" <sam@...dozajonas.com>,
        "David S. Miller" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Ben Wei <benwei@...com>
Subject: [PATCH] net/ncsi: add control packet payload to NC-SI commands from
 netlink

This patch adds support for NCSI_CMD_SEND_CMD netlink command to load packet data payload (up to 16 bytes) to standard NC-SI commands.

Packet data will be loaded from NCSI_ATTR_DATA attribute similar to NC-SI OEM commands

Signed-off-by: Ben Wei <benwei@...com>
---
 net/ncsi/internal.h     | 7 ++++---
 net/ncsi/ncsi-netlink.c | 9 +++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h index 0b3f0673e1a2..4ff442faf5dc 100644
--- a/net/ncsi/internal.h
+++ b/net/ncsi/internal.h
@@ -328,9 +328,10 @@ struct ncsi_cmd_arg {
 	unsigned short       payload;     /* Command packet payload length */
 	unsigned int         req_flags;   /* NCSI request properties       */
 	union {
-		unsigned char  bytes[16]; /* Command packet specific data  */
-		unsigned short words[8];
-		unsigned int   dwords[4];
+#define NCSI_MAX_DATA_BYTES 16
+		unsigned char  bytes[NCSI_MAX_DATA_BYTES]; /* Command packet specific data  */
+		unsigned short words[NCSI_MAX_DATA_BYTES / sizeof(unsigned short)];
+		unsigned int   dwords[NCSI_MAX_DATA_BYTES / sizeof(unsigned int)];
 	};
 	unsigned char        *data;       /* NCSI OEM data                 */
 	struct genl_info     *info;       /* Netlink information           */
diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c index 8b386d766e7d..7d2a43f30eb1 100644
--- a/net/ncsi/ncsi-netlink.c
+++ b/net/ncsi/ncsi-netlink.c
@@ -459,6 +459,15 @@ static int ncsi_send_cmd_nl(struct sk_buff *msg, struct genl_info *info)
 	nca.payload = ntohs(hdr->length);
 	nca.data = data + sizeof(*hdr);
 
+	if (nca.payload <= NCSI_MAX_DATA_BYTES) {
+		memcpy(nca.bytes, nca.data, nca.payload);
+	} else {
+		netdev_info(ndp->ndev.dev, "NCSI:payload size %u exceeds max %u\n",
+			    nca.payload, NCSI_MAX_DATA_BYTES);
+		ret = -EINVAL;
+		goto out_netlink;
+	}
+
 	ret = ncsi_xmit_cmd(&nca);
 out_netlink:
 	if (ret != 0) {
--
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ