net: ath9k: fix use-after-free in ath9k_hif_usb_rx_cb
Subsystems (3)
PATCH 1/1 net: ath9k: fix use-after-free in ath9k_hif_usb_rx_cb
Syzbot reported use-after-free Read in ath9k_hif_usb_rx_cb(). The problem was in incorrect htc_handle->drv_priv initialization.
Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/* htc_handle->drv_priv = priv; */
ath9k_htc_wait_for_target() <--- Failed
ieee80211_free_hw() <--- priv pointer is freed
<IRQ>
...ath9k_hif_usb_rx_cb()
ath9k_hif_usb_rx_stream()
RX_STAT_INC() <--- htc_handle->drv_priv access
In order to not add fancy protection for drv_priv we can move htc_handle->drv_priv initialization at the end of the ath9k_htc_probe_device() and add helper macro to make all *_STAT_* macros NULL save.
Also, I made whitespaces clean ups in *_STAT_* macros definitions to make checkpatch.pl happy.
---
Hi, ath9k maintainer/developers!
I know, that you do not like changes, that wasn't tested on real hardware. I really don't access to this one, so I'd like you to test it on real hardware piece, if you have one. At least, this patch was tested by syzbot [1]
[1] https://syzkaller.appspot.com/bug?id=6ead44e37afb6866ac0c7dd121b4ce07cb665f60
--- drivers/net/wireless/ath/ath9k/htc.h | 11 ++++++----- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/htc.h +6 -5
@@ -326,11 +326,12 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)#ifdef CONFIG_ATH9K_HTC_DEBUGFS -#define TX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) -#define TX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) -#define RX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) -#define RX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) -#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ +#define __STAT_SAVE (expr) (hif_dev->htc_handle->drv_priv ? (expr) : 0) +#define TX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) +#define TX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) +#define RX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) +#define RX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) +#define CAB_STAT_INC (priv->debug.tx_stats.cab_queued++)#define TX_QSTAT_INC (q) (priv->debug.tx_stats.queue_stats[q]++)
drivers/net/wireless/ath/ath9k/htc_drv_init.c +2 -1
@@ -944,7 +944,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, priv->hw = hw; priv->htc = htc_handle; priv->dev = dev; - htc_handle->drv_priv = priv;SET_IEEE80211_DEV (hw, priv->dev); ret =ath9k_htc_wait_for_target (priv);
@@ -965,6 +964,8 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,if (ret) goto err_init; + htc_handle->drv_priv = priv; +return 0 ; err_init:
Signature · 1 line
2.32.0
Quoted 79 lines · Pavel Skripkin
Syzbot reported use-after-free Read in
ath9k_hif_usb_rx_cb(). The problem was in incorrecthtc_handle->drv_privinitialization.Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/*htc_handle->drv_priv= priv; */
ath9k_htc_wait_for_target()<--- Failed
ieee80211_free_hw()<--- priv pointer is freed<IRQ> ... ath9k_hif_usb_rx_cb() ath9k_hif_usb_rx_stream() RX_STAT_INC() <--- htc_handle->drv_priv accessIn order to not add fancy protection for
drv_privwe can movehtc_handle->drv_privinitialization at the end of theath9k_htc_probe_device()and add helper macro to make all *_STAT_* macros NULL save.Also, I made whitespaces clean ups in *_STAT_* macros definitions to make checkpatch.pl happy.
Fixes fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")Reported-and-tested-by [email protected]Signed-off-by Pavel Skripkin <[email protected]>---
Hi, ath9k maintainer/developers!
I know, that you do not like changes, that wasn't tested on real hardware. I really don't access to this one, so I'd like you to test it on real hardware piece, if you have one. At least, this patch was tested by syzbot [1]
[1] https://syzkaller.appspot.com/bug?id=6ead44e37afb6866ac0c7dd121b4ce07cb665f60
--- drivers/net/wireless/ath/ath9k/htc.h | 11 ++++++----- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-)drivers/net/wireless/ath/ath9k/htc.h +6
-5@@ -326,11 +326,12 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)#ifdef CONFIG_ATH9K_HTC_DEBUGFS -#define TX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) -#define TX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) -#define RX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) -#define RX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) -#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ +#define __STAT_SAVE (expr) (hif_dev->htc_handle->drv_priv ? (expr) : 0) +#define TX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) +#define TX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) +#define RX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) +#define RX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) +#define CAB_STAT_INC (priv->debug.tx_stats.cab_queued++)#define TX_QSTAT_INC (q) (priv->debug.tx_stats.queue_stats[q]++)drivers/net/wireless/ath/ath9k/htc_drv_init.c +0
-1@@ -944,7 +944,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, priv->hw = hw; priv->htc = htc_handle; priv->dev = dev; - htc_handle->drv_priv = priv;SET_IEEE80211_DEV (hw, priv->dev); ret =ath9k_htc_wait_for_target (priv);
drivers/net/wireless/ath/ath9k/htc_drv_init.c int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, · line 971
Quoted 8 lines
drivers/net/wireless/ath/ath9k/htc_drv_init.c +2
-0@@ -965,6 +964,8 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,if (ret) goto err_init; + htc_handle->drv_priv = priv; +return 0 ; err_init:
Added missing LKML in CC. Sorry for confusion.
With regards,
Pavel Skripkin
Quoted 82 lines · Pavel Skripkin
Quoted 81 lines · Pavel Skripkin
Syzbot reported use-after-free Read in
ath9k_hif_usb_rx_cb(). The problem was in incorrecthtc_handle->drv_privinitialization.Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/*htc_handle->drv_priv= priv; */
ath9k_htc_wait_for_target()<--- Failed
ieee80211_free_hw()<--- priv pointer is freed<IRQ> ... ath9k_hif_usb_rx_cb() ath9k_hif_usb_rx_stream() RX_STAT_INC() <--- htc_handle->drv_priv accessIn order to not add fancy protection for
drv_privwe can movehtc_handle->drv_privinitialization at the end of theath9k_htc_probe_device()and add helper macro to make all *_STAT_* macros NULL save.Also, I made whitespaces clean ups in *_STAT_* macros definitions to make checkpatch.pl happy.
Fixes fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")Reported-and-tested-by [email protected]Signed-off-by Pavel Skripkin <[email protected]>---
Hi, ath9k maintainer/developers!
I know, that you do not like changes, that wasn't tested on real hardware. I really don't access to this one, so I'd like you to test it on real hardware piece, if you have one. At least, this patch was tested by syzbot [1]
[1] https://syzkaller.appspot.com/bug?id=6ead44e37afb6866ac0c7dd121b4ce07cb665f60
--- drivers/net/wireless/ath/ath9k/htc.h | 11 ++++++----- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-)drivers/net/wireless/ath/ath9k/htc.h +6
-5@@ -326,11 +326,12 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)#ifdef CONFIG_ATH9K_HTC_DEBUGFS -#define TX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) -#define TX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) -#define RX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) -#define RX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) -#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ +#define __STAT_SAVE (expr) (hif_dev->htc_handle->drv_priv ? (expr) : 0) +#define TX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) +#define TX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) +#define RX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) +#define RX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) +#define CAB_STAT_INC (priv->debug.tx_stats.cab_queued++)#define TX_QSTAT_INC (q) (priv->debug.tx_stats.queue_stats[q]++)drivers/net/wireless/ath/ath9k/htc_drv_init.c +0
-1@@ -944,7 +944,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, priv->hw = hw; priv->htc = htc_handle; priv->dev = dev; - htc_handle->drv_priv = priv;SET_IEEE80211_DEV (hw, priv->dev); ret =ath9k_htc_wait_for_target (priv);@@ -965,6 +964,8 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,if (ret) goto err_init;
Quoted 10 lines
drivers/net/wireless/ath/ath9k/htc_drv_init.c int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, · line 971
Quoted 6 lines
drivers/net/wireless/ath/ath9k/htc_drv_init.c +2
-0+ htc_handle->drv_priv = priv; +return 0 ; err_init:Added missing LKML in CC. Sorry for confusion.
Any chance to review this patch? Thanks
With regards,
Pavel Skripkin
Quoted 87 lines · Pavel Skripkin
Quoted 86 lines · Pavel Skripkin
Quoted 85 lines · Pavel Skripkin
Syzbot reported use-after-free Read in
ath9k_hif_usb_rx_cb(). The problem was in incorrecthtc_handle->drv_privinitialization.Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/*htc_handle->drv_priv= priv; */
ath9k_htc_wait_for_target()<--- Failed
ieee80211_free_hw()<--- priv pointer is freed<IRQ> ... ath9k_hif_usb_rx_cb() ath9k_hif_usb_rx_stream() RX_STAT_INC() <--- htc_handle->drv_priv accessIn order to not add fancy protection for
drv_privwe can movehtc_handle->drv_privinitialization at the end of theath9k_htc_probe_device()and add helper macro to make all *_STAT_* macros NULL save.Also, I made whitespaces clean ups in *_STAT_* macros definitions to make checkpatch.pl happy.
Fixes fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")Reported-and-tested-by [email protected]Signed-off-by Pavel Skripkin <[email protected]>---
Hi, ath9k maintainer/developers!
I know, that you do not like changes, that wasn't tested on real hardware. I really don't access to this one, so I'd like you to test it on real hardware piece, if you have one. At least, this patch was tested by syzbot [1]
[1] https://syzkaller.appspot.com/bug?id=6ead44e37afb6866ac0c7dd121b4ce07cb665f60
--- drivers/net/wireless/ath/ath9k/htc.h | 11 ++++++----- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-)drivers/net/wireless/ath/ath9k/htc.h +6
-5@@ -326,11 +326,12 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)#ifdef CONFIG_ATH9K_HTC_DEBUGFS -#define TX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) -#define TX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) -#define RX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) -#define RX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) -#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ +#define __STAT_SAVE (expr) (hif_dev->htc_handle->drv_priv ? (expr) : 0) +#define TX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) +#define TX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) +#define RX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) +#define RX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) +#define CAB_STAT_INC (priv->debug.tx_stats.cab_queued++)#define TX_QSTAT_INC (q) (priv->debug.tx_stats.queue_stats[q]++)drivers/net/wireless/ath/ath9k/htc_drv_init.c +2
-1@@ -944,7 +944,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, priv->hw = hw; priv->htc = htc_handle; priv->dev = dev; - htc_handle->drv_priv = priv;SET_IEEE80211_DEV (hw, priv->dev); ret =ath9k_htc_wait_for_target (priv);@@ -965,6 +964,8 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,if (ret) goto err_init; + htc_handle->drv_priv = priv; +return 0 ;
Quoted 9 lines
Quoted 6 lines
drivers/net/wireless/ath/ath9k/htc_drv_init.c int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, · line 971
Quoted 2 lines
drivers/net/wireless/ath/ath9k/htc_drv_init.c +0
-0err_init:Added missing LKML in CC. Sorry for confusion.
Any chance to review this patch? Thanks
gentle ping one more time :) Thanks
With regards,
Pavel Skripkin
PATCH RESEND 1/1 net: ath9k: fix use-after-free in ath9k_hif_usb_rx_cb
Syzbot reported use-after-free Read in ath9k_hif_usb_rx_cb(). The problem was in incorrect htc_handle->drv_priv initialization.
Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/* htc_handle->drv_priv = priv; */
ath9k_htc_wait_for_target() <--- Failed
ieee80211_free_hw() <--- priv pointer is freed
<IRQ>
...ath9k_hif_usb_rx_cb()
ath9k_hif_usb_rx_stream()
RX_STAT_INC() <--- htc_handle->drv_priv access
In order to not add fancy protection for drv_priv we can move htc_handle->drv_priv initialization at the end of the ath9k_htc_probe_device() and add helper macro to make all *_STAT_* macros NULL save.
---
Why resend?
No activity on this patch since 8/6/21, Kalle Valo has asked around, for review and no one claimed it.
Resend changes:
1. Rebased on top of v5.15-rc2
2. Removed clean ups for macros
3. Added 1 more syzbot tag, since this patch has passed 2 syzbot tests
--- drivers/net/wireless/ath/ath9k/htc.h | 10 +++++----- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/htc.h +5 -5
@@ -325,11 +325,11 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb) }#ifdef CONFIG_ATH9K_HTC_DEBUGFS - -#define TX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) -#define TX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) -#define RX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) -#define RX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a) +#define __STAT_SAVE (expr) (hif_dev->htc_handle->drv_priv ? (expr) : 0) +#define TX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) +#define TX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a) +#define RX_STAT_INC (c) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c++) +#define RX_STAT_ADD (c, a) __STAT_SAVE(hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c += a)#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++#define TX_QSTAT_INC (q) (priv->debug.tx_stats.queue_stats[q]++)
drivers/net/wireless/ath/ath9k/htc_drv_init.c +2 -1
@@ -944,7 +944,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, priv->hw = hw; priv->htc = htc_handle; priv->dev = dev; - htc_handle->drv_priv = priv;SET_IEEE80211_DEV (hw, priv->dev); ret =ath9k_htc_wait_for_target (priv);
@@ -965,6 +964,8 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,if (ret) goto err_init; + htc_handle->drv_priv = priv; +return 0 ; err_init:
Signature · 1 line
2.33.0
Quoted 31 lines · Pavel Skripkin
Syzbot reported use-after-free Read in
ath9k_hif_usb_rx_cb(). The problem was in incorrecthtc_handle->drv_privinitialization.Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/*htc_handle->drv_priv= priv; */
ath9k_htc_wait_for_target()<--- Failed
ieee80211_free_hw()<--- priv pointer is freed<IRQ> ... ath9k_hif_usb_rx_cb() ath9k_hif_usb_rx_stream() RX_STAT_INC() <--- htc_handle->drv_priv accessIn order to not add fancy protection for
drv_privwe can movehtc_handle->drv_privinitialization at the end of theath9k_htc_probe_device()and add helper macro to make all *_STAT_* macros NULL save.Fixes fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")Reported-and-tested-by [email protected]Reported-and-tested-by [email protected]Signed-off-by Pavel Skripkin <[email protected]>---
Why resend?
No activity on this patch since 8/6/21, Kalle Valo has asked around, for review and no one claimed it.
Quoted 6 lines
Resend changes:
1. Rebased on top of v5.15-rc2
2. Removed clean ups for macros
3. Added 1 more syzbot tag, since this patch has passed 2 syzbot tests
Hi, ath9k maintainers!
Does this patch need any further work? I can't see any comments on it since 8/6/21 and I can't see it on wireless patchwork.
If this bug is already fixed and I've overlooked a fix commit, please, let me know. As I see syzbot hits this bug really often [1]
Thanks
[1] https://syzkaller.appspot.com/bug?id=6ead44e37afb6866ac0c7dd121b4ce07cb665f60
With regards,
Pavel Skripkin
Quoted 39 lines · Pavel Skripkin
Quoted 31 lines · Pavel Skripkin
Syzbot reported use-after-free Read in
ath9k_hif_usb_rx_cb(). The problem was in incorrecthtc_handle->drv_privinitialization.Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/*htc_handle->drv_priv= priv; */
ath9k_htc_wait_for_target()<--- Failed
ieee80211_free_hw()<--- priv pointer is freed<IRQ> ... ath9k_hif_usb_rx_cb() ath9k_hif_usb_rx_stream() RX_STAT_INC() <--- htc_handle->drv_priv accessIn order to not add fancy protection for
drv_privwe can movehtc_handle->drv_privinitialization at the end of theath9k_htc_probe_device()and add helper macro to make all *_STAT_* macros NULL save.Fixes fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")Reported-and-tested-by [email protected]Reported-and-tested-by [email protected]Signed-off-by Pavel Skripkin <[email protected]>---
Why resend?
No activity on this patch since 8/6/21, Kalle Valo has asked around, for review and no one claimed it.Quoted 6 lines
Resend changes:
1. Rebased on top of v5.15-rc2
2. Removed clean ups for macros
3. Added 1 more syzbot tag, since this patch has passed 2 syzbot tests
Quoted 7 lines
Hi, ath9k maintainers!
Does this patch need any further work? I can't see any comments on it since 8/6/21 and I can't see it on wireless patchwork.
If this bug is already fixed and I've overlooked a fix commit, please, let me know. As I see syzbot hits this bug really often [1]
See my other mail I just sent about ath9k syzbot patches:
https://lore.kernel.org/linux-wireless/[email protected]/
In summary: please wait patiently once I'm able to test the syzbot patches on a real device.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 8 lines · Kalle Valo
Quoted 7 lines
Hi, ath9k maintainers!
Does this patch need any further work? I can't see any comments on it since 8/6/21 and I can't see it on wireless patchwork.
If this bug is already fixed and I've overlooked a fix commit, please, let me know. As I see syzbot hits this bug really often [1]
Quoted 7 lines
See my other mail I just sent about ath9k syzbot patches:
https://lore.kernel.org/linux-wireless/[email protected]/
In summary: please wait patiently once I'm able to test the syzbot patches on a real device.
I see, thank you clarifying the situation. I understand, that maintaining ath9k devices alone is not easy task
Thanks again
With regards,
Pavel Skripkin
Quoted 16 lines · Pavel Skripkin
Syzbot reported use-after-free Read in
ath9k_hif_usb_rx_cb(). The problem was in incorrecthtc_handle->drv_privinitialization.Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/*htc_handle->drv_priv= priv; */
ath9k_htc_wait_for_target()<--- Failed
ieee80211_free_hw()<--- priv pointer is freed<IRQ>...
ath9k_hif_usb_rx_cb()
ath9k_hif_usb_rx_stream()
RX_STAT_INC()<---htc_handle->drv_privaccess
Quoted 7 lines
In order to not add fancy protection for
drv_privwe can movehtc_handle->drv_privinitialization at the end of theath9k_htc_probe_device()and add helper macro to make all *_STAT_* macros NULL save.Also, I made whitespaces clean ups in *_STAT_* macros definitions to make checkpatch.pl happy.
Separate patch for cleanups, please.
Quoted 5 lines
Fixes fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")Reported-and-tested-by [email protected]Signed-off-by Pavel Skripkin <[email protected]>---
Quoted 8 lines
Hi, ath9k maintainer/developers!
I know, that you do not like changes, that wasn't tested on real hardware. I really don't access to this one, so I'd like you to test it on real hardware piece, if you have one. At least, this patch was tested by syzbot [1]
[1] https://syzkaller.appspot.com/bug?id=6ead44e37afb6866ac0c7dd121b4ce07cb665f60
syzbot does not equal testing on real hardware. Can someone test or review this, please?
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 31 lines · Pavel Skripkin
Syzbot reported use-after-free Read in
ath9k_hif_usb_rx_cb(). The problem was in incorrecthtc_handle->drv_privinitialization.Probable call trace which can trigger use-after-free:
ath9k_htc_probe_device()
/*htc_handle->drv_priv= priv; */
ath9k_htc_wait_for_target()<--- Failed
ieee80211_free_hw()<--- priv pointer is freed<IRQ> ... ath9k_hif_usb_rx_cb() ath9k_hif_usb_rx_stream() RX_STAT_INC() <--- htc_handle->drv_priv accessIn order to not add fancy protection for
drv_privwe can movehtc_handle->drv_privinitialization at the end of theath9k_htc_probe_device()and add helper macro to make all *_STAT_* macros NULL save.Also, I made whitespaces clean ups in *_STAT_* macros definitions to make checkpatch.pl happy.
Fixes fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")Reported-and-tested-by [email protected]Signed-off-by Pavel Skripkin <[email protected]>---
Hi, ath9k maintainer/developers!
Quoted 8 lines
I know, that you do not like changes, that wasn't tested on real hardware. I really don't access to this one, so I'd like you to test it on real hardware piece, if you have one. At least, this patch was tested by syzbot [1]
[1] https://syzkaller.appspot.com/bug?id=6ead44e37afb6866ac0c7dd121b4ce07cb665f60
---
Btw, this patch also passes this syzbot test
https://syzkaller.appspot.com/bug?id=b8101ffcec107c0567a0cd8acbbacec91e9ee8de
With regards,
Pavel Skripkin