lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210204211934.273e54bf@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Thu, 4 Feb 2021 21:19:34 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Vadym Kochan <vadym.kochan@...ision.eu>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Oleksandr Mazur <oleksandr.mazur@...ision.eu>,
        Serhiy Boiko <serhiy.boiko@...ision.eu>,
        Serhiy Pshyk <serhiy.pshyk@...ision.eu>,
        Volodymyr Mytnyk <volodymyr.mytnyk@...ision.eu>,
        Taras Chornyi <taras.chornyi@...ision.eu>,
        netdev@...r.kernel.org, Mickey Rachamim <mickeyr@...vell.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 7/7] net: marvell: prestera: fix port event
 handling on init

On Wed,  3 Feb 2021 18:54:58 +0200 Vadym Kochan wrote:
> For some reason there might be a crash during ports creation if port
> events are handling at the same time  because fw may send initial
> port event with down state.
> 
> The crash points to cancel_delayed_work() which is called when port went
> is down.  Currently I did not find out the real cause of the issue, so
> fixed it by cancel port stats work only if previous port's state was up
> & runnig.

Maybe you just need to move the DELAYED_WORK_INIT() earlier?
Not sure why it's at the end of prestera_port_create(), it 
just initializes some fields.

> [   28.489791] Call trace:
> [   28.492259]  get_work_pool+0x48/0x60
> [   28.495874]  cancel_delayed_work+0x38/0xb0
> [   28.500011]  prestera_port_handle_event+0x90/0xa0 [prestera]
> [   28.505743]  prestera_evt_recv+0x98/0xe0 [prestera]
> [   28.510683]  prestera_fw_evt_work_fn+0x180/0x228 [prestera_pci]
> [   28.516660]  process_one_work+0x1e8/0x360
> [   28.520710]  worker_thread+0x44/0x480
> [   28.524412]  kthread+0x154/0x160
> [   28.527670]  ret_from_fork+0x10/0x38
> [   28.531290] Code: a8c17bfd d50323bf d65f03c0 9278dc21 (f9400020)
> [   28.537429] ---[ end trace 5eced933df3a080b ]---
> 
> Signed-off-by: Vadym Kochan <vadym.kochan@...ision.eu>
> ---
>  drivers/net/ethernet/marvell/prestera/prestera_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> index 39465e65d09b..122324dae47d 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> @@ -433,7 +433,8 @@ static void prestera_port_handle_event(struct prestera_switch *sw,
>  			netif_carrier_on(port->dev);
>  			if (!delayed_work_pending(caching_dw))
>  				queue_delayed_work(prestera_wq, caching_dw, 0);
> -		} else {
> +		} else if (netif_running(port->dev) &&
> +			   netif_carrier_ok(port->dev)) {
>  			netif_carrier_off(port->dev);
>  			if (delayed_work_pending(caching_dw))
>  				cancel_delayed_work(caching_dw);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ