From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Leon Romanovsky <leon@kernel.org>,
netdev@vger.kernel.org, nbd@nbd.name, john@phrozen.org,
sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
lorenzo.bianconi@redhat.com
Subject: Re: [PATCH net-next] net: ethernet: mtk_wed: fix possible deadlock if mtk_wed_wo_init fails
Date: Wed, 7 Dec 2022 00:52:28 +0100 [thread overview]
Message-ID: <Y4/VvGi2d0/0RrRW@lore-desk> (raw)
In-Reply-To: <20221205174441.30741550@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]
> > > IMHO, it is a culprit, proper error unwind means that you won't call to
> > > uninit functions for something that is not initialized yet. It is better
> > > to fix it instead of adding "if (!wo) ..." checks.
> >
> > So, iiuc, you would prefer to do something like:
> >
> > __mtk_wed_detach()
> > {
> > ...
> > if (mtk_wed_get_rx_capa(dev) && wo) {
> > mtk_wed_wo_reset(dev);
> > mtk_wed_free_rx_rings(dev);
> > mtk_wed_wo_deinit(hw);
> > }
> > ...
> >
> > Right? I am fine both ways :)
>
> FWIW, that does seem slightly better to me as well.
> Also - aren't you really fixing multiple issues here
> (even if on the same error path)? The locking,
> the null-checking and the change in mtk_wed_wo_reset()?
wo NULL pointer issue was not hit before for the deadlock one (so I fixed them
in the same patch).
Do you prefer to split them in two patches? (wo null pointer fix first).
I have posted v2 addressing Leon's comments but I need to post a v3 to add
missing WARN_ON.
Regards,
Lorenzo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-12-06 23:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 17:36 [PATCH net-next] net: ethernet: mtk_wed: fix possible deadlock if mtk_wed_wo_init fails Lorenzo Bianconi
2022-12-04 13:06 ` Leon Romanovsky
2022-12-04 15:09 ` Lorenzo Bianconi
2022-12-05 7:29 ` Leon Romanovsky
2022-12-05 9:04 ` Lorenzo Bianconi
2022-12-05 9:32 ` Leon Romanovsky
2022-12-06 1:44 ` Jakub Kicinski
2022-12-06 23:52 ` Lorenzo Bianconi [this message]
2022-12-07 1:24 ` Jakub Kicinski
2022-12-07 8:58 ` 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=Y4/VvGi2d0/0RrRW@lore-desk \
--to=lorenzo@kernel.org \
--cc=Mark-MC.Lee@mediatek.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=john@phrozen.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sean.wang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox