diff mbox series

[wpan] ca8210: fix mac_len negative array access

Message ID 20230217042504.3303396-1-aahringo@redhat.com (mailing list archive)
State Accepted
Headers show
Series [wpan] ca8210: fix mac_len negative array access | expand

Commit Message

Alexander Aring Feb. 17, 2023, 4:25 a.m. UTC
This patch fixes a buffer overflow access of skb->data if
ieee802154_hdr_peek_addrs() fails.

Reported-by: lianhui tang <bluetlh@gmail.com>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 drivers/net/ieee802154/ca8210.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefan Schmidt Feb. 18, 2023, 3:27 p.m. UTC | #1
Hello.

On 17.02.23 05:25, Alexander Aring wrote:
> This patch fixes a buffer overflow access of skb->data if
> ieee802154_hdr_peek_addrs() fails.
> 
> Reported-by: lianhui tang <bluetlh@gmail.com>
> Signed-off-by: Alexander Aring <aahringo@redhat.com>
> ---
>   drivers/net/ieee802154/ca8210.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
> index e1a569b99e4a..0b0c6c0764fe 100644
> --- a/drivers/net/ieee802154/ca8210.c
> +++ b/drivers/net/ieee802154/ca8210.c
> @@ -1913,6 +1913,8 @@ static int ca8210_skb_tx(
>   	 * packet
>   	 */
>   	mac_len = ieee802154_hdr_peek_addrs(skb, &header);
> +	if (mac_len < 0)
> +		return mac_len;
>   
>   	secspec.security_level = header.sec.level;
>   	secspec.key_id_mode = header.sec.key_id_mode;

This patch has been applied to the wpan tree and will be
part of the next pull request to net. Thanks!

regards
Stefan Schmidt
diff mbox series

Patch

diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index e1a569b99e4a..0b0c6c0764fe 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -1913,6 +1913,8 @@  static int ca8210_skb_tx(
 	 * packet
 	 */
 	mac_len = ieee802154_hdr_peek_addrs(skb, &header);
+	if (mac_len < 0)
+		return mac_len;
 
 	secspec.security_level = header.sec.level;
 	secspec.key_id_mode = header.sec.key_id_mode;