]> git.baikalelectronics.ru Git - kernel.git/commit
net: hso: add failure handler for add_net_device
authorZiyang Xuan <william.xuanziyang@huawei.com>
Thu, 2 Sep 2021 08:36:09 +0000 (16:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Sep 2021 10:52:04 +0000 (11:52 +0100)
commit0ed5c87f5a72d21c5c9ce7860fa8ff1ff5dc3f68
tree8fd547ded0dfb9348118a09e9c5dee77b1c01cdf
parentf425e584a4b7c31f4043889e4cecdb68077fb8ae
net: hso: add failure handler for add_net_device

If the network devices connected to the system beyond
HSO_MAX_NET_DEVICES. add_net_device() in hso_create_net_device()
will be failed for the network_table is full. It will lead to
business failure which rely on network_table, for example,
hso_suspend() and hso_resume(). It will also lead to memory leak
because resource release process can not search the hso_device
object from network_table in hso_free_interface().

Add failure handler for add_net_device() in hso_create_net_device()
to solve the above problems.

Fixes: a3f20b1d831b ("HSO: add option hso driver")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/hso.c