stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Yuan Can <yuancan@huawei.com>,
	"David S. Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.0 052/124] net: net_netdev: Fix error handling in ntb_netdev_init_module()
Date: Mon,  5 Dec 2022 20:09:18 +0100	[thread overview]
Message-ID: <20221205190809.912648308@linuxfoundation.org> (raw)
In-Reply-To: <20221205190808.422385173@linuxfoundation.org>

From: Yuan Can <yuancan@huawei.com>

[ Upstream commit b8f79dccd38edf7db4911c353d9cd792ab13a327 ]

The ntb_netdev_init_module() returns the ntb_transport_register_client()
directly without checking its return value, if
ntb_transport_register_client() failed, the NTB client device is not
unregistered.

Fix by unregister NTB client device when ntb_transport_register_client()
failed.

Fixes: 548c237c0a99 ("net: Add support for NTB virtual ethernet device")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ntb_netdev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index 80bdc07f2cd3..dd7e273c90cb 100644
--- a/drivers/net/ntb_netdev.c
+++ b/drivers/net/ntb_netdev.c
@@ -484,7 +484,14 @@ static int __init ntb_netdev_init_module(void)
 	rc = ntb_transport_register_client_dev(KBUILD_MODNAME);
 	if (rc)
 		return rc;
-	return ntb_transport_register_client(&ntb_netdev_client);
+
+	rc = ntb_transport_register_client(&ntb_netdev_client);
+	if (rc) {
+		ntb_transport_unregister_client_dev(KBUILD_MODNAME);
+		return rc;
+	}
+
+	return 0;
 }
 module_init(ntb_netdev_init_module);
 
-- 
2.35.1




  parent reply	other threads:[~2022-12-05 19:28 UTC|newest]

Thread overview: 136+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 19:08 [PATCH 6.0 000/124] 6.0.12-rc1 review Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 001/124] btrfs: qgroup: fix sleep from invalid context bug in btrfs_qgroup_inherit() Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 002/124] drm/amdgpu: move setting the job resources Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 003/124] drm/amdgpu: cleanup error handling in amdgpu_cs_parser_bos Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 004/124] drm/amdgpu: fix userptr HMM range handling v2 Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 005/124] kbuild: fix -Wimplicit-function-declaration in license_is_gpl_compatible Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 006/124] drm/amd/pm: add smu_v13_0_10 driver if version Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 007/124] drm/amd/pm: update driver-if header for smu_v13_0_10 Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 008/124] drm/amd/pm: update driver if header for smu_13_0_7 Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 009/124] clk: samsung: exynos7885: Correct "div4" clock parents Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 010/124] clk: qcom: gdsc: add missing error handling Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 011/124] clk: qcom: gdsc: Remove direct runtime PM calls Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 012/124] iio: health: afe4403: Fix oob read in afe4403_read_raw Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 013/124] iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 014/124] iio: light: rpr0521: add missing Kconfig dependencies Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 015/124] libbpf: Use correct return pointer in attach_raw_tp Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 016/124] bpf, perf: Use subprog name when reporting subprog ksymbol Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 017/124] scripts/faddr2line: Fix regression in name resolution on ppc64le Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 018/124] ARM: at91: rm9200: fix usb device clock id Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 019/124] libbpf: Handle size overflow for ringbuf mmap Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 020/124] hwmon: (ltc2947) fix temperature scaling Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 021/124] hwmon: (ina3221) Fix shunt sum critical calculation Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 022/124] hwmon: (i5500_temp) fix missing pci_disable_device() Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 023/124] hwmon: (ibmpex) Fix possible UAF when ibmpex_register_bmc() fails Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 024/124] clocksource/drivers/arm_arch_timer: Fix XGene-1 TVAL register math error Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 025/124] bpf: Do not copy spin lock field from user in bpf_selem_alloc Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 026/124] nvmem: rmem: Fix return value check in rmem_read() Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 027/124] of: property: decrement node refcount in of_fwnode_get_reference_args() Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 028/124] clk: qcom: gcc-sc8280xp: add cxo as parent for three ufs ref clks Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 029/124] ixgbevf: Fix resource leak in ixgbevf_init_module() Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 030/124] i40e: Fix error handling in i40e_init_module() Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 031/124] fm10k: Fix error handling in fm10k_init_module() Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 032/124] iavf: Fix error handling in iavf_init_module() Greg Kroah-Hartman
2022-12-05 19:08 ` [PATCH 6.0 033/124] e100: Fix possible use after free in e100_xmit_prepare Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 034/124] net/mlx5: DR, Fix uninitialized var warning Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 035/124] net/mlx5: E-switch, Destroy legacy fdb table when needed Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 036/124] net/mlx5: E-switch, Fix duplicate lag creation Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 037/124] net/mlx5: Fix uninitialized variable bug in outlen_write() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 038/124] net/mlx5e: Fix use-after-free when reverting termination table Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 039/124] can: sja1000_isa: sja1000_isa_probe(): add missing free_sja1000dev() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 040/124] can: cc770: cc770_isa_probe(): add missing free_cc770dev() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 041/124] can: etas_es58x: es58x_init_netdev(): free netdev when register_candev() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 042/124] can: m_can: pci: add missing m_can_class_free_dev() in probe/remove methods Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 043/124] can: m_can: Add check for devm_clk_get Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 044/124] vfs: fix copy_file_range() averts filesystem freeze protection Greg Kroah-Hartman
2022-12-13  8:03   ` Amir Goldstein
2022-12-14 15:58     ` Greg Kroah-Hartman
2022-12-14 17:21       ` Amir Goldstein
2022-12-14 18:29         ` Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 045/124] qlcnic: fix sleep-in-atomic-context bugs caused by msleep Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 046/124] aquantia: Do not purge addresses when setting the number of rings Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 047/124] wifi: cfg80211: fix buffer overflow in elem comparison Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 048/124] wifi: cfg80211: dont allow multi-BSSID in S1G Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 049/124] wifi: mac8021: fix possible oob access in ieee80211_get_rate_duration Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 050/124] net: phy: fix null-ptr-deref while probe() failed Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 051/124] net: ethernet: ti: am65-cpsw: fix error handling in am65_cpsw_nuss_probe() Greg Kroah-Hartman
2022-12-05 19:09 ` Greg Kroah-Hartman [this message]
2022-12-05 19:09 ` [PATCH 6.0 053/124] net/9p: Fix a potential socket leak in p9_socket_open Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 054/124] net: ethernet: nixge: fix NULL dereference Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 055/124] net: wwan: iosm: fix kernel test robot reported error Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 056/124] net: wwan: iosm: fix dma_alloc_coherent incompatible pointer type Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 057/124] net: wwan: iosm: fix crash in peek throughput test Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 058/124] net: wwan: iosm: fix incorrect skb length Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 059/124] dsa: lan9303: Correct stat name Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 060/124] mptcp: dont orphan ssk in mptcp_close() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 061/124] mptcp: fix sleep in atomic at close time Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 062/124] tipc: re-fetch skb cb after tipc_msg_validate Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 063/124] net: hsr: Fix potential use-after-free Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 064/124] net: mdiobus: fix unbalanced node reference count Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 065/124] afs: Fix fileserver probe RTT handling Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 066/124] net: tun: Fix use-after-free in tun_detach() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 067/124] net/mlx5: Lag, Fix for loop when checking lag Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 068/124] packet: do not set TP_STATUS_CSUM_VALID on CHECKSUM_COMPLETE Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 069/124] sctp: fix memory leak in sctp_stream_outq_migrate() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 070/124] net: ethernet: renesas: ravb: Fix promiscuous mode after system resumed Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 071/124] afs: Fix server->active leak in afs_put_server Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 072/124] hwmon: (coretemp) Check for null before removing sysfs attrs Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 073/124] hwmon: (coretemp) fix pci device refcount leak in nv1a_ram_new() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 074/124] hwmon: (asus-ec-sensors) Add checks for devm_kcalloc Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 075/124] riscv: vdso: fix section overlapping under some conditions Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 076/124] riscv: mm: Proper page permissions after initmem free Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 077/124] ALSA: dice: fix regression for Lexicon I-ONIX FW810S Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 078/124] can: can327: can327_feed_frame_to_netdev(): fix potential skb leak when netdev is down Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 079/124] error-injection: Add prompt for function error injection Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 080/124] tools/vm/slabinfo-gnuplot: use "grep -E" instead of "egrep" Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 081/124] nilfs2: fix NULL pointer dereference in nilfs_palloc_commit_free_entry() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 082/124] x86/bugs: Make sure MSR_SPEC_CTRL is updated properly upon resume from S3 Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 083/124] pinctrl: intel: Save and restore pins in "direct IRQ" mode Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 084/124] v4l2: dont fall back to follow_pfn() if pin_user_pages_fast() fails Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 085/124] mm: migrate: fix THPs mapcount on isolation Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 086/124] net: stmmac: Set MACs flow control register to reflect current settings Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 087/124] mmc: mmc_test: Fix removal of debugfs file Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 088/124] mmc: mtk-sd: Fix missing clk_disable_unprepare in msdc_of_clock_parse() Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 089/124] mmc: core: Fix ambiguous TRIM and DISCARD arg Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 090/124] mmc: sdhci-esdhc-imx: correct CQHCI exit halt state check Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 091/124] mmc: sdhci-sprd: Fix no reset data and command after voltage switch Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 092/124] mmc: sdhci: Fix voltage switch delay Greg Kroah-Hartman
2022-12-05 19:09 ` [PATCH 6.0 093/124] Kconfig.debug: provide a little extra FRAME_WARN leeway when KASAN is enabled Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 094/124] drm/amdgpu: temporarily disable broken Clang builds due to blown stack-frame Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 095/124] drm/amdgpu: enable Vangogh VCN indirect sram mode Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 096/124] drm/i915: Fix negative value passed as remaining time Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 097/124] drm/i915: Never return 0 if not all requests retired Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 098/124] tracing/osnoise: Fix duration type Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 099/124] tracing: Fix race where histograms can be called before the event Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 100/124] tracing: Free buffers when a used dynamic event is removed Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 101/124] ASoC: ops: Fix bounds check for _sx controls Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 102/124] ASoC: tlv320adc3xxx: Fix build error for implicit function declaration Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 103/124] pinctrl: single: Fix potential division by zero Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 104/124] riscv: Sync efi page tables kernel mappings before switching Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 105/124] riscv: fix race when vmap stack overflow Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 106/124] riscv: kexec: Fixup irq controller broken in kexec crash path Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 107/124] riscv: kexec: Fixup crash_smp_send_stop without multi cores Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 108/124] nvme: fix SRCU protection of nvme_ns_head list Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 109/124] iommu/vt-d: Fix PCI device refcount leak in has_external_pci() Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 110/124] iommu/vt-d: Fix PCI device refcount leak in dmar_dev_scope_init() Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 111/124] ipv4: Handle attempt to delete multipath route when fib_info contains an nh reference Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 112/124] ipv4: Fix route deletion when nexthop info is not specified Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 113/124] mm/damon: introduce struct damos_access_pattern Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 114/124] mm/damon/sysfs: fix wrong empty schemes assumption under online tuning in damon_sysfs_set_schemes() Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 115/124] i2c: Restore initial power state if probe fails Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 116/124] i2c: npcm7xx: Fix error handling in npcm_i2c_init() Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 117/124] i2c: qcom-geni: fix error return code in geni_i2c_gpi_xfer Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 118/124] i2c: imx: Only DMA messages with I2C_M_DMA_SAFE flag set Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 119/124] ACPI: HMAT: remove unnecessary variable initialization Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 120/124] ACPI: HMAT: Fix initiator registration for single-initiator systems Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 121/124] Revert "clocksource/drivers/riscv: Events are stopped during CPU suspend" Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 122/124] char: tpm: Protect tpm_pm_suspend with locks Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 123/124] Input: raydium_ts_i2c - fix memory leak in raydium_i2c_send() Greg Kroah-Hartman
2022-12-05 19:10 ` [PATCH 6.0 124/124] powerpc/bpf/32: Fix Oops on tail call tests Greg Kroah-Hartman
2022-12-06  0:09 ` [PATCH 6.0 000/124] 6.0.12-rc1 review Florian Fainelli
2022-12-06  2:30 ` Shuah Khan
2022-12-06  7:26 ` Ron Economos
2022-12-06  7:57 ` Fenil Jain
2022-12-06  8:26 ` Bagas Sanjaya
2022-12-06 10:03 ` Naresh Kamboju
2022-12-06 18:08 ` Allen Pais

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=20221205190809.912648308@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).