linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76: mt7915: fix possible NULL pointer dereference in mt7915_register_ext_phy
@ 2020-05-22  7:26 Lorenzo Bianconi
  2020-05-22  7:45 ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2020-05-22  7:26 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, lorenzo.bianconi, sean.wang, ryder.lee,
	dan.carpenter

Fix a NULL pointer dereference in mt7915_register_ext_phy since phy
data structure is allocated by mt76_alloc_phy routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
- I have just compile tested this patch
---
 drivers/net/wireless/mediatek/mt76/mt7915/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 6f200ab3ac28..aadf56e80bae 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -592,7 +592,6 @@ int mt7915_register_ext_phy(struct mt7915_dev *dev)
 	if (phy)
 		return 0;
 
-	INIT_DELAYED_WORK(&phy->mac_work, mt7915_mac_work);
 	mt7915_cap_dbdc_enable(dev);
 	mphy = mt76_alloc_phy(&dev->mt76, sizeof(*phy), &mt7915_ops);
 	if (!mphy)
@@ -605,6 +604,8 @@ int mt7915_register_ext_phy(struct mt7915_dev *dev)
 	mphy->antenna_mask = BIT(hweight8(phy->chainmask)) - 1;
 	mt7915_init_wiphy(mphy->hw);
 
+	INIT_DELAYED_WORK(&phy->mac_work, mt7915_mac_work);
+
 	/*
 	 * Make the secondary PHY MAC address local without overlapping with
 	 * the usual MAC address allocation scheme on multiple virtual interfaces
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mt76: mt7915: fix possible NULL pointer dereference in mt7915_register_ext_phy
  2020-05-22  7:26 [PATCH] mt76: mt7915: fix possible NULL pointer dereference in mt7915_register_ext_phy Lorenzo Bianconi
@ 2020-05-22  7:45 ` Dan Carpenter
  2020-05-22  7:51   ` Lorenzo Bianconi
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2020-05-22  7:45 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: nbd, linux-wireless, lorenzo.bianconi, sean.wang, ryder.lee


On Fri, May 22, 2020 at 09:26:06AM +0200, Lorenzo Bianconi wrote:
> Fix a NULL pointer dereference in mt7915_register_ext_phy since phy
> data structure is allocated by mt76_alloc_phy routine
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>

Thanks!  Could you fix the same the bug in mt7615_register_ext_phy() as
well?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mt76: mt7915: fix possible NULL pointer dereference in mt7915_register_ext_phy
  2020-05-22  7:45 ` Dan Carpenter
@ 2020-05-22  7:51   ` Lorenzo Bianconi
  2020-05-22  8:38     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2020-05-22  7:51 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: nbd, linux-wireless, lorenzo.bianconi, sean.wang, ryder.lee

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

> 
> On Fri, May 22, 2020 at 09:26:06AM +0200, Lorenzo Bianconi wrote:
> > Fix a NULL pointer dereference in mt7915_register_ext_phy since phy
> > data structure is allocated by mt76_alloc_phy routine
> > 
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> Thanks!  Could you fix the same the bug in mt7615_register_ext_phy() as
> well?

Hi Dan,

I have already posted the fix here: https://patchwork.kernel.org/patch/11553519/
The patch is already in Felix's tree.

Regards,
Lorenzo

> 
> regards,
> dan carpenter
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mt76: mt7915: fix possible NULL pointer dereference in mt7915_register_ext_phy
  2020-05-22  7:51   ` Lorenzo Bianconi
@ 2020-05-22  8:38     ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-05-22  8:38 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: nbd, linux-wireless, lorenzo.bianconi, sean.wang, ryder.lee

On Fri, May 22, 2020 at 09:51:24AM +0200, Lorenzo Bianconi wrote:
> > 
> > On Fri, May 22, 2020 at 09:26:06AM +0200, Lorenzo Bianconi wrote:
> > > Fix a NULL pointer dereference in mt7915_register_ext_phy since phy
> > > data structure is allocated by mt76_alloc_phy routine
> > > 
> > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > 
> > Thanks!  Could you fix the same the bug in mt7615_register_ext_phy() as
> > well?
> 
> Hi Dan,
> 
> I have already posted the fix here: https://patchwork.kernel.org/patch/11553519/
> The patch is already in Felix's tree.

Fantastic.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-22  8:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-22  7:26 [PATCH] mt76: mt7915: fix possible NULL pointer dereference in mt7915_register_ext_phy Lorenzo Bianconi
2020-05-22  7:45 ` Dan Carpenter
2020-05-22  7:51   ` Lorenzo Bianconi
2020-05-22  8:38     ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).