diff options
| author | Matt Johnston <matt@codeconstruct.com.au> | 2024-10-22 18:25:14 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-11-08 16:30:59 +0100 |
| commit | 8c222adadc1612e4f097688875962a28e3f5ab44 (patch) | |
| tree | 026752cd30f1fa4d3bef00ff79e572b7963ac613 | |
| parent | dc9031b7919bd346514ea9a720f433b8daf3970d (diff) | |
| download | linux-8c222adadc1612e4f097688875962a28e3f5ab44.tar.gz linux-8c222adadc1612e4f097688875962a28e3f5ab44.tar.bz2 linux-8c222adadc1612e4f097688875962a28e3f5ab44.zip | |
mctp i2c: handle NULL header address
[ Upstream commit 01e215975fd80af81b5b79f009d49ddd35976c13 ]
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: f5b8abf9fc3d ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | drivers/net/mctp/mctp-i2c.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c index 4dc057c121f5..e70fb6687994 100644 --- a/drivers/net/mctp/mctp-i2c.c +++ b/drivers/net/mctp/mctp-i2c.c @@ -588,6 +588,9 @@ static int mctp_i2c_header_create(struct sk_buff *skb, struct net_device *dev, if (len > MCTP_I2C_MAXMTU) return -EMSGSIZE; + if (!daddr || !saddr) + return -EINVAL; + lldst = *((u8 *)daddr); llsrc = *((u8 *)saddr); |
