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, Vikas Gupta <vikas.gupta@broadcom.com>,
	Michael Chan <michael.chan@broadcom.com>,
	Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.0 65/94] bnxt_en: fix memory leak in bnxt_nvm_test()
Date: Thu, 27 Oct 2022 18:55:07 +0200	[thread overview]
Message-ID: <20221027165059.793016468@linuxfoundation.org> (raw)
In-Reply-To: <20221027165057.208202132@linuxfoundation.org>

From: Vikas Gupta <vikas.gupta@broadcom.com>

[ Upstream commit ba077d683d45190afc993c1ce45bcdbfda741a40 ]

Free the kzalloc'ed buffer before returning in the success path.

Fixes: 5b6ff128fdf6 ("bnxt_en: implement callbacks for devlink selftests")
Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/1666020742-25834-1-git-send-email-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index a36803e79e92..8a6f788f6294 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -613,6 +613,7 @@ static int bnxt_dl_reload_up(struct devlink *dl, enum devlink_reload_action acti
 
 static bool bnxt_nvm_test(struct bnxt *bp, struct netlink_ext_ack *extack)
 {
+	bool rc = false;
 	u32 datalen;
 	u16 index;
 	u8 *buf;
@@ -632,20 +633,20 @@ static bool bnxt_nvm_test(struct bnxt *bp, struct netlink_ext_ack *extack)
 
 	if (bnxt_get_nvram_item(bp->dev, index, 0, datalen, buf)) {
 		NL_SET_ERR_MSG_MOD(extack, "nvm test vpd read error");
-		goto err;
+		goto done;
 	}
 
 	if (bnxt_flash_nvram(bp->dev, BNX_DIR_TYPE_VPD, BNX_DIR_ORDINAL_FIRST,
 			     BNX_DIR_EXT_NONE, 0, 0, buf, datalen)) {
 		NL_SET_ERR_MSG_MOD(extack, "nvm test vpd write error");
-		goto err;
+		goto done;
 	}
 
-	return true;
+	rc = true;
 
-err:
+done:
 	kfree(buf);
-	return false;
+	return rc;
 }
 
 static bool bnxt_dl_selftest_check(struct devlink *dl, unsigned int id,
-- 
2.35.1




  parent reply	other threads:[~2022-10-27 17:00 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 16:54 [PATCH 6.0 00/94] 6.0.6-rc1 review Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 01/94] [PATCH v2] video/aperture: Call sysfb_disable() before removing PCI devices Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 02/94] ocfs2: clear dinode links count in case of error Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 03/94] ocfs2: fix BUG when iput after ocfs2_mknod fails Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 04/94] smb3: interface count displayed incorrectly Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 05/94] selinux: enable use of both GFP_KERNEL and GFP_ATOMIC in convert_context() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 06/94] cpufreq: qcom: fix writes in read-only memory region Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 07/94] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 08/94] cpufreq: tegra194: Fix module loading Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 09/94] x86/microcode/AMD: Apply the patch early on every logical thread Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 10/94] hwmon/coretemp: Handle large core ID value Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 11/94] ata: ahci-imx: Fix MODULE_ALIAS Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 12/94] ata: ahci: Match EM_MAX_SLOTS with SATA_PMP_MAX_PORTS Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 13/94] x86/resctrl: Fix min_cbm_bits for AMD Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 14/94] cpufreq: qcom: fix memory leak in error path Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 15/94] drm/amdgpu: fix sdma doorbell init ordering on APUs Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 16/94] mm,hugetlb: take hugetlb_lock before decrementing h->resv_huge_pages Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 17/94] kvm: Add support for arch compat vm ioctls Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 18/94] KVM: x86: Copy filter arg outside kvm_vm_ioctl_set_msr_filter() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 19/94] KVM: x86: Add compat handler for KVM_X86_SET_MSR_FILTER Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 20/94] KVM: arm64: vgic: Fix exit condition in scan_its_table() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 21/94] media: ipu3-imgu: Fix NULL pointer dereference in active selection access Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 22/94] media: mceusb: set timeout to at least timeout provided Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 23/94] media: venus: dec: Handle the case where find_format fails Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 24/94] media: venus: Fix NV12 decoder buffer discovery on HFI_VERSION_1XX Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 25/94] x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 26/94] x86/topology: Fix multiple packages shown on a single-package system Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 27/94] x86/topology: Fix duplicated core ID within a package Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 28/94] platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 29/94] dm bufio: use the acquire memory barrier when testing for B_READING Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 30/94] btrfs: fix processing of delayed data refs during backref walking Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 31/94] btrfs: fix processing of delayed tree block " Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 32/94] drm/vc4: Add module dependency on hdmi-codec Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 33/94] drm/vc4: hdmi: Enforce the minimum rate at runtime_resume Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 34/94] ACPI: extlog: Handle multiple records Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 35/94] tipc: Fix recognition of trial period Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 36/94] tipc: fix an information leak in tipc_topsrv_kern_subscr Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 37/94] net: dsa: qca8k: fix inband mgmt for big-endian systems Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 38/94] net: dsa: qca8k: fix ethtool autocast mib " Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 39/94] i40e: Fix DMA mappings leak Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 40/94] tls: strp: make sure the TCP skbs do not have overlapping data Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 41/94] HID: magicmouse: Do not set BTN_MOUSE on double report Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 42/94] sfc: Change VF mac via PF as first preference if available Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 43/94] net/atm: fix proc_mpc_write incorrect return value Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 44/94] net: phy: dp83867: Extend RX strap quirk for SGMII mode Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 45/94] net/smc: Fix an error code in smc_lgr_create() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 46/94] net: phylink: add mac_managed_pm in phylink_config structure Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 47/94] net: stmmac: Enable mac_managed_pm phylink config Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 48/94] skmsg: pass gfp argument to alloc_sk_msg() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 49/94] erofs: shouldnt churn the mapping page for duplicated copies Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 50/94] blk-mq: fix null pointer dereference in blk_mq_clear_rq_mapping() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 51/94] io_uring/rw: remove leftover debug statement Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 52/94] net: ethernet: mtk_eth_soc: fix possible memory leak in mtk_probe() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 53/94] net: ethernet: mtk_eth_wed: add missing put_device() in mtk_wed_add_hw() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 54/94] net: ethernet: mtk_eth_wed: add missing of_node_put() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 55/94] scsi: lpfc: Fix memory leak in lpfc_create_port() Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 56/94] udp: Update reuse->has_conns under reuseport_lock Greg Kroah-Hartman
2022-10-27 16:54 ` [PATCH 6.0 57/94] ip6mr: fix UAF issue in ip6mr_sk_done() when addrconf_init_net() failed Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 58/94] cifs: Fix xid leak in cifs_create() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 59/94] cifs: Fix xid leak in cifs_copy_file_range() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 60/94] cifs: Fix xid leak in cifs_flock() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 61/94] cifs: Fix xid leak in cifs_ses_add_channel() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 62/94] cifs: Fix memory leak when build ntlmssp negotiate blob failed Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 63/94] dm: remove unnecessary assignment statement in alloc_dev() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 64/94] drm/amd/display: Increase frame size limit for display_mode_vba_util_32.o Greg Kroah-Hartman
2022-10-27 16:55 ` Greg Kroah-Hartman [this message]
2022-10-27 16:55 ` [PATCH 6.0 66/94] net: hsr: avoid possible NULL deref in skb_clone() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 67/94] ionic: catch NULL pointer issue on reconfig Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 68/94] netfilter: rpfilter/fib: Populate flowic_l3mdev field Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 69/94] netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 70/94] netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 71/94] nvme-hwmon: consistently ignore errors from nvme_hwmon_init Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 72/94] nvme-hwmon: kmalloc the NVME SMART log buffer Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 73/94] nvmet: fix workqueue MEM_RECLAIM flushing dependency Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 74/94] net: sched: cake: fix null pointer access issue when cake_init() fails Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 75/94] net: sched: delete duplicate cleanup of backlog and qlen Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 76/94] net: sched: sfb: fix null pointer access issue when sfb_init() fails Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 77/94] net: Fix return value of qdisc ingress handling on success Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 78/94] io_uring/msg_ring: Fix NULL pointer dereference in io_msg_send_fd() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 79/94] sfc: include vport_id in filter spec hash and equal() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 80/94] wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 81/94] net: hns: fix possible memory leak in hnae_ae_register() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 82/94] net: sched: fix race condition in qdisc_graft() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 83/94] net: phy: dp83822: disable MDI crossover status change interrupt Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 84/94] drbd: only clone bio if we have a backing device Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 85/94] rv/dot2c: Make automaton definition static Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 86/94] iommu/vt-d: Allow NVS regions in arch_rmrr_sanity_check() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 87/94] iommu/vt-d: Clean up si_domain in the init_dmars() error path Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 88/94] wifi: mt76: mt7921e: fix random fw download fail Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 89/94] io_uring: dont gate task_work run on TIF_NOTIFY_SIGNAL Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 90/94] ext4: introduce EXT4_FC_TAG_BASE_LEN helper Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 91/94] ext4: factor out ext4_fc_get_tl() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 92/94] ext4: fix potential out of bound read in ext4_fc_replay_scan() Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 93/94] [PATCH v3] ACPI: video: Force backlight native for more TongFang devices Greg Kroah-Hartman
2022-10-27 16:55 ` [PATCH 6.0 94/94] mm: /proc/pid/smaps_rollup: fix no vmas null-deref Greg Kroah-Hartman
2022-10-27 17:11 ` [PATCH 6.0 00/94] 6.0.6-rc1 review Greg Kroah-Hartman
2022-10-27 18:22 ` Luna Jernberg
2022-10-27 18:46 ` Holger Hoffstätte
2022-10-27 21:13 ` Justin Forbes
2022-10-28  8:20 ` Bagas Sanjaya
2022-10-28  9:20 ` Naresh Kamboju
2022-10-28  9:25 ` Ron Economos
2022-10-28 10:18 ` Rudi Heitbaum
2022-10-28 10:35 ` Sudip Mukherjee (Codethink)
2022-10-28 11:59 ` Jon Hunter
2022-10-28 22:01 ` Florian Fainelli
2022-10-29  3:36 ` Guenter Roeck

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=20221027165059.793016468@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vikas.gupta@broadcom.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).