[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2zIgJblD4I7DOn+@unreal>
Date: Thu, 10 Nov 2022 11:46:40 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Yuan Can <yuancan@...wei.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, mqaio@...ux.alibaba.com,
shaozhengchao@...wei.com, christophe.jaillet@...adoo.fr,
gustavoars@...nel.org, luobin9@...wei.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2] net: hinic: Fix error handling in hinic_module_init()
On Thu, Nov 10, 2022 at 02:16:42AM +0000, Yuan Can wrote:
> A problem about hinic create debugfs failed is triggered with the
> following log given:
>
> [ 931.419023] debugfs: Directory 'hinic' with parent '/' already present!
>
> The reason is that hinic_module_init() returns pci_register_driver()
> directly without checking its return value, if pci_register_driver()
> failed, it returns without destroy the newly created debugfs, resulting
> the debugfs of hinic can never be created later.
>
> hinic_module_init()
> hinic_dbg_register_debugfs() # create debugfs directory
> pci_register_driver()
> driver_register()
> bus_add_driver()
> priv = kzalloc(...) # OOM happened
> # return without destroy debugfs directory
>
> Fix by removing debugfs when pci_register_driver() returns error.
>
> Fixes: 253ac3a97921 ("hinic: add support to query sq info")
> Signed-off-by: Yuan Can <yuancan@...wei.com>
> ---
> Changes in v2:
> - Change to simpler error handling style
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@...dia.com>
Powered by blists - more mailing lists