tipc: fix a bit overflow in tipc_crypto_key_rcv()
authorHangyu Hua <hbh25y@gmail.com>
Fri, 11 Feb 2022 04:55:10 +0000 (12:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Mar 2022 18:09:29 +0000 (19:09 +0100)
[ Upstream commit 143de8d97d79316590475dc2a84513c63c863ddf ]

msg_data_sz return a 32bit value, but size is 16bit. This may lead to a
bit overflow.

Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tipc/crypto.c

index d8a2f424786fcc4a2162b888e0f43597d4e05a6f..6f91b9a306dc39e8ce91977c5485948b2ff7cde7 100644 (file)
@@ -2280,7 +2280,7 @@ static bool tipc_crypto_key_rcv(struct tipc_crypto *rx, struct tipc_msg *hdr)
        struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx;
        struct tipc_aead_key *skey = NULL;
        u16 key_gen = msg_key_gen(hdr);
-       u16 size = msg_data_sz(hdr);
+       u32 size = msg_data_sz(hdr);
        u8 *data = msg_data(hdr);
        unsigned int keylen;