Skip to content

Commit

Permalink
mctp i3c: handle NULL header address
Browse files Browse the repository at this point in the history
daddr can be NULL if there is no neighbour table entry present,
in that case the tx packet should be dropped.

saddr will usually be set by MCTP core, but check for NULL in case a
packet is transmitted by a different protocol.

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Fixes: c8755b2 ("mctp i3c: MCTP I3C driver")
Link: https://patch.msgid.link/20250304-mctp-i3c-null-v1-1-4416bbd56540@codeconstruct.com.au
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Matt Johnston authored and Paolo Abeni committed Mar 6, 2025
1 parent ccc2f5a commit cf7ee25
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/mctp/mctp-i3c.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ static int mctp_i3c_header_create(struct sk_buff *skb, struct net_device *dev,
{
struct mctp_i3c_internal_hdr *ihdr;

if (!daddr || !saddr)
return -EINVAL;

skb_push(skb, sizeof(struct mctp_i3c_internal_hdr));
skb_reset_mac_header(skb);
ihdr = (void *)skb_mac_header(skb);
Expand Down

0 comments on commit cf7ee25

Please sign in to comment.