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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260115155808.36102-8-damien.riegel@silabs.com>
Date: Thu, 15 Jan 2026 10:58:00 -0500
From: Damien Riégel <damien.riegel@...abs.com>
To: greybus-dev@...ts.linaro.org, Johan Hovold <johan@...nel.org>,
        Alex Elder <elder@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Cc: Silicon Labs Kernel Team <linux-devel@...abs.com>,
        Damien Riégel <damien.riegel@...abs.com>
Subject: [PATCH v2 07/14] greybus: cpc: account for CPC header size in RX and TX path

Account that a CPC header is prepended to every frame in the RX and TX
path. For now, nothing is done with that headroom but at least bytes are
reserved for it.

Signed-off-by: Damien Riégel <damien.riegel@...abs.com>
---
 drivers/greybus/cpc/host.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/greybus/cpc/host.c b/drivers/greybus/cpc/host.c
index 7ffa3bf4021..c89617623e8 100644
--- a/drivers/greybus/cpc/host.c
+++ b/drivers/greybus/cpc/host.c
@@ -9,6 +9,7 @@
 #include <linux/skbuff.h>
 
 #include "cpc.h"
+#include "header.h"
 #include "host.h"
 
 static struct cpc_host_device *gb_hd_to_cpc_hd(struct gb_host_device *hd)
@@ -48,11 +49,13 @@ static int cpc_hd_message_send(struct cpc_host_device *cpc_hd, u16 cport_id,
 		return -EINVAL;
 	}
 
-	size = sizeof(*message->header) + message->payload_size;
+	size = sizeof(*message->header) + message->payload_size + CPC_HEADER_SIZE;
 	skb = alloc_skb(size, gfp_mask);
 	if (!skb)
 		return -ENOMEM;
 
+	skb_reserve(skb, CPC_HEADER_SIZE);
+
 	/* Header and payload are already contiguous in Greybus message */
 	skb_put_data(skb, message->buffer, sizeof(*message->header) + message->payload_size);
 
@@ -209,9 +212,11 @@ void cpc_hd_rcvd(struct cpc_host_device *cpc_hd, struct sk_buff *skb)
 	u16 cport_id;
 
 	/* Prevent an out-of-bound access if called with non-sensical parameters. */
-	if (skb->len < sizeof(*gb_hdr))
+	if (skb->len < (sizeof(*gb_hdr) + CPC_HEADER_SIZE))
 		goto free_skb;
 
+	skb_pull(skb, CPC_HEADER_SIZE);
+
 	/* Retrieve cport ID that was packed in Greybus header */
 	gb_hdr = (struct gb_operation_msg_hdr *)skb->data;
 	cport_id = cpc_cport_unpack(gb_hdr);
-- 
2.52.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ