Skip to content

Commit

Permalink
wifi: mt76: connac: fix possible unaligned access in mt76_connac_mcu_…
Browse files Browse the repository at this point in the history
…add_nested_tlv

[ Upstream commit 0a4860f ]

Fix possible unaligned pointer in mt76_connac_mcu_add_nested_tlv
routine.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 25702d9 ("mt76: connac: rely on le16_add_cpu in mt76_connac_mcu_add_nested_tlv")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
LorenzoBianconi authored and gregkh committed Oct 21, 2022
1 parent 0c1bcc0 commit 06c13c1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,10 @@ mt76_connac_mcu_add_nested_tlv(struct sk_buff *skb, int tag, int len,
ntlv = le16_to_cpu(ntlv_hdr->tlv_num);
ntlv_hdr->tlv_num = cpu_to_le16(ntlv + 1);

if (sta_hdr)
le16_add_cpu(&sta_hdr->len, len);
if (sta_hdr) {
len += le16_to_cpu(sta_hdr->len);
sta_hdr->len = cpu_to_le16(len);
}

return ptlv;
}
Expand Down

0 comments on commit 06c13c1

Please sign in to comment.