]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net: ionic: Fix error handling in ionic_init_module()
authorYuan Can <yuancan@huawei.com>
Sun, 13 Nov 2022 09:29:29 +0000 (09:29 +0000)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 12:59:29 +0000 (13:59 +0100)
commit328a4c68cc4de190f9d57aa269e15ba952e7e98c
tree4753f42f21ffb0c79575976e66e39124f40b56a4
parentc0e892c42a266d676423b949563efa3d95526519
net: ionic: Fix error handling in ionic_init_module()

[ Upstream commit 280c0f7cd0aa4d190619b18243110e052a90775c ]

A problem about ionic create debugfs failed is triggered with the
following log given:

 [  415.799514] debugfs: Directory 'ionic' with parent '/' already present!

The reason is that ionic_init_module() returns ionic_bus_register_driver()
directly without checking its return value, if ionic_bus_register_driver()
failed, it returns without destroy the newly created debugfs, resulting
the debugfs of ionic can never be created later.

 ionic_init_module()
   ionic_debugfs_create() # create debugfs directory
   ionic_bus_register_driver()
     pci_register_driver()
       driver_register()
         bus_add_driver()
           priv = kzalloc(...) # OOM happened
   # return without destroy debugfs directory

Fix by removing debugfs when ionic_bus_register_driver() returns error.

Fixes: fbfb8031533c ("ionic: Add hardware init and device commands")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Acked-by: Shannon Nelson <snelson@pensando.io>
Link: https://lore.kernel.org/r/20221113092929.19161-1-yuancan@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2540eea1bdc32aefedcf80a3cb9f40dc4a7be576)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
drivers/net/ethernet/pensando/ionic/ionic_main.c