All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Yuan Can <yuancan@huawei.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, mqaio@linux.alibaba.com,
	shaozhengchao@huawei.com, christophe.jaillet@wanadoo.fr,
	gustavoars@kernel.org, luobin9@huawei.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2] net: hinic: Fix error handling in hinic_module_init()
Date: Thu, 10 Nov 2022 11:46:40 +0200	[thread overview]
Message-ID: <Y2zIgJblD4I7DOn+@unreal> (raw)
In-Reply-To: <20221110021642.80378-1-yuancan@huawei.com>

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@huawei.com>
> ---
> Changes in v2:
> - Change to simpler error handling style
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

  reply	other threads:[~2022-11-10  9:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10  2:16 [PATCH v2] net: hinic: Fix error handling in hinic_module_init() Yuan Can
2022-11-10  9:46 ` Leon Romanovsky [this message]
2022-11-12  5:10 ` patchwork-bot+netdevbpf

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=Y2zIgJblD4I7DOn+@unreal \
    --to=leon@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gustavoars@kernel.org \
    --cc=kuba@kernel.org \
    --cc=luobin9@huawei.com \
    --cc=mqaio@linux.alibaba.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shaozhengchao@huawei.com \
    --cc=yuancan@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.