From: David Miller <davem@davemloft.net>
To: u.kleine-koenig@pengutronix.de
Cc: andrew@lunn.ch, vivien.didelot@savoirfairelinux.com,
f.fainelli@gmail.com, netdev@vger.kernel.org,
kernel@pengutronix.de
Subject: Re: [PATCH] net: dsa: mv88e6xxx: fix races between lock and irq freeing
Date: Sat, 21 Jul 2018 22:44:09 -0700 (PDT) [thread overview]
Message-ID: <20180721.224409.437815752648454744.davem@davemloft.net> (raw)
In-Reply-To: <20180720095315.21055-1-u.kleine-koenig@pengutronix.de>
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Fri, 20 Jul 2018 11:53:15 +0200
> free_irq() waits until all handlers for this IRQ have completed. As the
> relevant handler (mv88e6xxx_g1_irq_thread_fn()) takes the chip's reg_lock
> it might never return if the thread calling free_irq() holds this lock.
>
> For the same reason kthread_cancel_delayed_work_sync() in the polling case
> must not hold this lock.
>
> Also first free the irq (or stop the worker respectively) such that
> mv88e6xxx_g1_irq_thread_work() isn't called any more before the irq
> mappings are dropped in mv88e6xxx_g1_irq_free_common() to prevent the
> worker thread to call handle_nested_irq(0) which results in a NULL-pointer
> exception.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Looks good.
Note than the IRQ domain unmapping will do a synchronize_irq() which
should cause the same deadlock as free_irq() will with the reg_lock
held.
Note also that g2 IRQ freeing gets the ordering right, and doesn't need
a lock because it doesn't program any registers when tearing down it's
IRQ.
Applied and queued up for -stable, thanks.
next prev parent reply other threads:[~2018-07-22 6:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 9:53 [PATCH] net: dsa: mv88e6xxx: fix races between lock and irq freeing Uwe Kleine-König
2018-07-22 5:44 ` David Miller [this message]
2018-07-22 19:00 ` Uwe Kleine-König
2018-07-22 20:04 ` David Miller
2018-07-22 20:38 ` Uwe Kleine-König
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=20180721.224409.437815752648454744.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
--cc=vivien.didelot@savoirfairelinux.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