All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ryder.lee@mediatek.com
Cc: linux-mediatek@lists.infradead.org,
	Ryder Lee <ryder.lee@mediatek.com>,
	linux-wireless@vger.kernel.org
Subject: [bug report] mt76: mt7915: fix possible deadlock in mt7915_stop
Date: Wed, 20 May 2020 15:09:33 +0300	[thread overview]
Message-ID: <20200520120845.GK172354@mwanda> (raw)

Hello Ryder Lee,

The patch 57b9df6fa5f5: "mt76: mt7915: fix possible deadlock in
mt7915_stop" from May 12, 2020, leads to the following static checker
warning:

    drivers/net/wireless/mediatek/mt76/mt7915/init.c:595 mt7915_register_ext_phy()
    error: we previously assumed 'phy' could be null (see line 592)

    drivers/net/wireless/mediatek/mt76/mt7615/init.c:371 mt7615_register_ext_phy()
    error: we previously assumed 'phy' could be null (see line 368)

drivers/net/wireless/mediatek/mt76/mt7915/init.c
   589          if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
   590                  return -EINVAL;
   591  
   592          if (phy)
                    ^^^
   593                  return 0;
   594  
   595          INIT_DELAYED_WORK(&phy->mac_work, mt7915_mac_work);
                                  ^^^^^^^^^^^^^^
This will Oops.

   596          mt7915_cap_dbdc_enable(dev);
   597          mphy = mt76_alloc_phy(&dev->mt76, sizeof(*phy), &mt7915_ops);
   598          if (!mphy)
   599                  return -ENOMEM;
   600  
   601          phy = mphy->priv;
                ^^^^^^^^^^^^^^^^
phy is set here again.

   602          phy->dev = dev;
   603          phy->mt76 = mphy;
   604          phy->chainmask = dev->chainmask & ~dev->phy.chainmask;
   605          mphy->antenna_mask = BIT(hweight8(phy->chainmask)) - 1;
   606          mt7915_init_wiphy(mphy->hw);

See also:
drivers/net/wireless/mediatek/mt76/mt7615/init.c:371 mt7615_register_ext_phy() error: we previously assumed 'phy' could be null (see line 368)

regards,
dan carpenter

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ryder.lee@mediatek.com
Cc: Ryder Lee <ryder.lee@mediatek.com>,
	linux-wireless@vger.kernel.org,
	linux-mediatek@lists.infradead.org
Subject: [bug report] mt76: mt7915: fix possible deadlock in mt7915_stop
Date: Wed, 20 May 2020 15:09:33 +0300	[thread overview]
Message-ID: <20200520120845.GK172354@mwanda> (raw)

Hello Ryder Lee,

The patch 57b9df6fa5f5: "mt76: mt7915: fix possible deadlock in
mt7915_stop" from May 12, 2020, leads to the following static checker
warning:

    drivers/net/wireless/mediatek/mt76/mt7915/init.c:595 mt7915_register_ext_phy()
    error: we previously assumed 'phy' could be null (see line 592)

    drivers/net/wireless/mediatek/mt76/mt7615/init.c:371 mt7615_register_ext_phy()
    error: we previously assumed 'phy' could be null (see line 368)

drivers/net/wireless/mediatek/mt76/mt7915/init.c
   589          if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
   590                  return -EINVAL;
   591  
   592          if (phy)
                    ^^^
   593                  return 0;
   594  
   595          INIT_DELAYED_WORK(&phy->mac_work, mt7915_mac_work);
                                  ^^^^^^^^^^^^^^
This will Oops.

   596          mt7915_cap_dbdc_enable(dev);
   597          mphy = mt76_alloc_phy(&dev->mt76, sizeof(*phy), &mt7915_ops);
   598          if (!mphy)
   599                  return -ENOMEM;
   600  
   601          phy = mphy->priv;
                ^^^^^^^^^^^^^^^^
phy is set here again.

   602          phy->dev = dev;
   603          phy->mt76 = mphy;
   604          phy->chainmask = dev->chainmask & ~dev->phy.chainmask;
   605          mphy->antenna_mask = BIT(hweight8(phy->chainmask)) - 1;
   606          mt7915_init_wiphy(mphy->hw);

See also:
drivers/net/wireless/mediatek/mt76/mt7615/init.c:371 mt7615_register_ext_phy() error: we previously assumed 'phy' could be null (see line 368)

regards,
dan carpenter

             reply	other threads:[~2020-05-20 12:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20 12:09 Dan Carpenter [this message]
2020-05-20 12:09 ` [bug report] mt76: mt7915: fix possible deadlock in mt7915_stop Dan Carpenter

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=20200520120845.GK172354@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=ryder.lee@mediatek.com \
    /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.