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: stable@vger.kernel.org Reported-by: Dung Cao <dung@os.amperecomputing.com> Signed-off-by: Matt Johnston <matt@codeconstruct.com.au> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20241022-mctp-i2c-null-dest-v3-1-e929709956c5@codeconstruct.com.au Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 90e0569 commit 01e2159

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

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)