netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	Asmaa Mnebhi <asmaa@nvidia.com>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org, cai.huoqing@linux.dev,
	brgl@bgdev.pl, chenhao288@hisilicon.com,
	huangguangbin2@huawei.com,
	David Thompson <davthompson@nvidia.com>
Subject: Re: [PATCH net v2 1/1] mlxbf_gige: Fix kernel panic at shutdown
Date: Tue, 13 Jun 2023 13:10:38 +0300	[thread overview]
Message-ID: <20230613101038.GY12152@unreal> (raw)
In-Reply-To: <20230613093501.46x4rvyhhyx5wo3b@skbuf>

On Tue, Jun 13, 2023 at 12:35:01PM +0300, Vladimir Oltean wrote:
> On Tue, Jun 13, 2023 at 12:09:20PM +0300, Leon Romanovsky wrote:
> > On Tue, Jun 13, 2023 at 11:30:02AM +0300, Vladimir Oltean wrote:
> > > On Tue, Jun 13, 2023 at 10:19:59AM +0300, Leon Romanovsky wrote:
> > > > But once child finishes device_shutdown(), it will be removed from devices_kset
> > > > list and dev->driver should be NULL at that point for the child.
> > > 
> > > What piece of code would make dev->driver be NULL for devices that have
> > > been shut down by device_shutdown()?
> > 
> > You are right here and I'm wrong on that point, dev->driver is set to
> > NULL in all other places where the device is going to be reused and not
> > in device_shutdown().
> > 
> > Unfortunately, it doesn't change a lot in our conversation, as device_shutdown()
> > is very specific call which is called in two flows: kernel_halt() and kernel_restart().
> > 
> > In both flows, it is end game.
> > 
> > Thanks
> 
> Except for the fact that, as mentioned in my first reply to this thread,
> bus drivers may implement .shutdown() the same way as .remove(), so in
> that case, someone *will* unbind the drivers from those child devices,
> *after* .shutdown() was called on the child - and if the child device
> driver isn't prepared to handle that, it can dereference NULL pointers
> and bye bye reboot - the kernel hangs.
> 
> Not really sure where you're aiming with your replies at this stage.

My goal is to explain that "bus drivers may implement .shutdown() 
the same way as .remove()" is wrong implementation and expectation
that all drivers will add "if (!priv) return ..." now is not viable.

Thanks

  reply	other threads:[~2023-06-13 10:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 14:03 [PATCH net v2 1/1] mlxbf_gige: Fix kernel panic at shutdown Asmaa Mnebhi
2023-06-08 23:25 ` Samudrala, Sridhar
2023-06-12 17:26   ` Jakub Kicinski
2023-06-11 18:11 ` Leon Romanovsky
2023-06-12 11:34   ` Maciej Fijalkowski
2023-06-12 11:59     ` Leon Romanovsky
2023-06-12 12:37       ` Vladimir Oltean
2023-06-12 13:17         ` Leon Romanovsky
2023-06-12 13:28           ` Vladimir Oltean
2023-06-12 13:38             ` Leon Romanovsky
2023-06-12 14:05               ` Vladimir Oltean
2023-06-13  7:19                 ` Leon Romanovsky
2023-06-13  8:30                   ` Vladimir Oltean
2023-06-13  9:09                     ` Leon Romanovsky
2023-06-13  9:35                       ` Vladimir Oltean
2023-06-13 10:10                         ` Leon Romanovsky [this message]
2023-06-13 10:34                           ` Vladimir Oltean
2023-06-13 11:28                             ` Leon Romanovsky
2023-06-13 11:40                               ` Vladimir Oltean

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=20230613101038.GY12152@unreal \
    --to=leon@kernel.org \
    --cc=asmaa@nvidia.com \
    --cc=brgl@bgdev.pl \
    --cc=cai.huoqing@linux.dev \
    --cc=chenhao288@hisilicon.com \
    --cc=davem@davemloft.net \
    --cc=davthompson@nvidia.com \
    --cc=edumazet@google.com \
    --cc=huangguangbin2@huawei.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).