Skip to content

Commit 01e2159

Browse files
mkjkuba-moo
authored andcommitted
mctp i2c: handle NULL header address
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. Fixes: f5b8abf ("mctp i2c: MCTP I2C binding driver") Cc: [email protected] Reported-by: Dung Cao <[email protected]> Signed-off-by: Matt Johnston <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/20241022-mctp-i2c-null-dest-v3-1-e929709956c5@codeconstruct.com.au Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 90e0569 commit 01e2159

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/mctp/mctp-i2c.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,9 @@ static int mctp_i2c_header_create(struct sk_buff *skb, struct net_device *dev,
588588
if (len > MCTP_I2C_MAXMTU)
589589
return -EMSGSIZE;
590590

591+
if (!daddr || !saddr)
592+
return -EINVAL;
593+
591594
lldst = *((u8 *)daddr);
592595
llsrc = *((u8 *)saddr);
593596

0 commit comments

Comments
 (0)