From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org>,
Ryder Lee <ryder.lee-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>,
Lorenzo Bianconi
<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Roy Luo <royluo-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Matthias Brugger
<matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] mt76: mt7615: Use after free in mt7615_mcu_set_bcn()
Date: Sat, 04 May 2019 09:52:16 +0000 [thread overview]
Message-ID: <20190504095215.GA23263@localhost.localdomain> (raw)
In-Reply-To: <20190503130909.GI29695@mwanda>
[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
> We dereference "skb" when we assign:
>
> req.pkt_len = cpu_to_le16(MT_TXD_SIZE + skb->len);
> ^^^^^^^^
> So this patch just moves the dev_kfree_skb() down a bit to avoid the
> use after free.
>
> Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index ea67c6022fe6..dc1301effa24 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -1270,7 +1270,6 @@ int mt7615_mcu_set_bcn(struct mt7615_dev *dev, struct ieee80211_vif *vif,
> mt7615_mac_write_txwi(dev, (__le32 *)(req.pkt), skb, wcid, NULL,
> 0, NULL);
> memcpy(req.pkt + MT_TXD_SIZE, skb->data, skb->len);
> - dev_kfree_skb(skb);
>
> req.omac_idx = mvif->omac_idx;
> req.enable = en;
> @@ -1281,6 +1280,7 @@ int mt7615_mcu_set_bcn(struct mt7615_dev *dev, struct ieee80211_vif *vif,
> req.pkt_len = cpu_to_le16(MT_TXD_SIZE + skb->len);
> req.tim_ie_pos = cpu_to_le16(MT_TXD_SIZE + tim_off);
>
> + dev_kfree_skb(skb);
> skb = mt7615_mcu_msg_alloc(&req, sizeof(req));
>
> return mt7615_mcu_msg_send(dev, skb, MCU_EXT_CMD_BCN_OFFLOAD,
> --
> 2.18.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Bianconi <lorenzo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org>,
Ryder Lee <ryder.lee-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>,
Lorenzo Bianconi
<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Roy Luo <royluo-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Matthias Brugger
<matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] mt76: mt7615: Use after free in mt7615_mcu_set_bcn()
Date: Sat, 4 May 2019 11:52:16 +0200 [thread overview]
Message-ID: <20190504095215.GA23263@localhost.localdomain> (raw)
In-Reply-To: <20190503130909.GI29695@mwanda>
[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]
Acked-by: Lorenzo Bianconi <lorenzo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> We dereference "skb" when we assign:
>
> req.pkt_len = cpu_to_le16(MT_TXD_SIZE + skb->len);
> ^^^^^^^^
> So this patch just moves the dev_kfree_skb() down a bit to avoid the
> use after free.
>
> Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
> drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index ea67c6022fe6..dc1301effa24 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -1270,7 +1270,6 @@ int mt7615_mcu_set_bcn(struct mt7615_dev *dev, struct ieee80211_vif *vif,
> mt7615_mac_write_txwi(dev, (__le32 *)(req.pkt), skb, wcid, NULL,
> 0, NULL);
> memcpy(req.pkt + MT_TXD_SIZE, skb->data, skb->len);
> - dev_kfree_skb(skb);
>
> req.omac_idx = mvif->omac_idx;
> req.enable = en;
> @@ -1281,6 +1280,7 @@ int mt7615_mcu_set_bcn(struct mt7615_dev *dev, struct ieee80211_vif *vif,
> req.pkt_len = cpu_to_le16(MT_TXD_SIZE + skb->len);
> req.tim_ie_pos = cpu_to_le16(MT_TXD_SIZE + tim_off);
>
> + dev_kfree_skb(skb);
> skb = mt7615_mcu_msg_alloc(&req, sizeof(req));
>
> return mt7615_mcu_msg_send(dev, skb, MCU_EXT_CMD_BCN_OFFLOAD,
> --
> 2.18.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Felix Fietkau <nbd@nbd.name>, Ryder Lee <ryder.lee@mediatek.com>,
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
Roy Luo <royluo@google.com>, Kalle Valo <kvalo@codeaurora.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mt76: mt7615: Use after free in mt7615_mcu_set_bcn()
Date: Sat, 4 May 2019 11:52:16 +0200 [thread overview]
Message-ID: <20190504095215.GA23263@localhost.localdomain> (raw)
In-Reply-To: <20190503130909.GI29695@mwanda>
[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
> We dereference "skb" when we assign:
>
> req.pkt_len = cpu_to_le16(MT_TXD_SIZE + skb->len);
> ^^^^^^^^
> So this patch just moves the dev_kfree_skb() down a bit to avoid the
> use after free.
>
> Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index ea67c6022fe6..dc1301effa24 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -1270,7 +1270,6 @@ int mt7615_mcu_set_bcn(struct mt7615_dev *dev, struct ieee80211_vif *vif,
> mt7615_mac_write_txwi(dev, (__le32 *)(req.pkt), skb, wcid, NULL,
> 0, NULL);
> memcpy(req.pkt + MT_TXD_SIZE, skb->data, skb->len);
> - dev_kfree_skb(skb);
>
> req.omac_idx = mvif->omac_idx;
> req.enable = en;
> @@ -1281,6 +1280,7 @@ int mt7615_mcu_set_bcn(struct mt7615_dev *dev, struct ieee80211_vif *vif,
> req.pkt_len = cpu_to_le16(MT_TXD_SIZE + skb->len);
> req.tim_ie_pos = cpu_to_le16(MT_TXD_SIZE + tim_off);
>
> + dev_kfree_skb(skb);
> skb = mt7615_mcu_msg_alloc(&req, sizeof(req));
>
> return mt7615_mcu_msg_send(dev, skb, MCU_EXT_CMD_BCN_OFFLOAD,
> --
> 2.18.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2019-05-04 9:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-03 13:09 [PATCH] mt76: mt7615: Use after free in mt7615_mcu_set_bcn() Dan Carpenter
2019-05-03 13:09 ` Dan Carpenter
2019-05-03 13:09 ` Dan Carpenter
2019-05-04 9:52 ` Lorenzo Bianconi [this message]
2019-05-04 9:52 ` Lorenzo Bianconi
2019-05-04 9:52 ` Lorenzo Bianconi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190504095215.GA23263@localhost.localdomain \
--to=lorenzo@kernel.org \
--cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=nbd-Vt+b4OUoWG0@public.gmane.org \
--cc=royluo-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=ryder.lee-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.