From: Zijie Zhao <zzjas98@gmail.com>
To: bhelgaas@google.com, sathyanarayanan.kuppuswamy@linux.intel.com
Cc: linux-pci@vger.kernel.org, chenyuan0y@gmail.com,
Zijie Zhao <zzjas98@gmail.com>
Subject: [PATCH] fix memory leak in pci_bus_set_aer_ops
Date: Thu, 14 Mar 2024 01:19:46 -0500 [thread overview]
Message-ID: <20240314061945.1324128-1-zzjas98@gmail.com> (raw)
In-Reply-To: <518813f8-294f-461c-b0dc-e980893a9ebf@linux.intel.com>
Remove unnecessary bus_ops = NULL assignment in pci_bus_set_aer_ops to
prevent a memory leak when ops are equal to &aer_inj_pci_ops. This change
ensures allocated bus_ops memory is properly freed.
Signed-off-by: Zijie Zhao <zzjas98@gmail.com>
---
drivers/pci/pcie/aer_inject.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pci/pcie/aer_inject.c b/drivers/pci/pcie/aer_inject.c
index 2dab275d252f..0c84fadbfd2e 100644
--- a/drivers/pci/pcie/aer_inject.c
+++ b/drivers/pci/pcie/aer_inject.c
@@ -309,7 +309,6 @@ static int pci_bus_set_aer_ops(struct pci_bus *bus)
goto out;
pci_bus_ops_init(bus_ops, bus, ops);
list_add(&bus_ops->list, &pci_bus_ops_list);
- bus_ops = NULL;
out:
spin_unlock_irqrestore(&inject_lock, flags);
kfree(bus_ops);
--
2.34.1
next prev parent reply other threads:[~2024-03-14 6:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 2:20 [drivers/pci] Possible memleak in pci_bus_set_aer_ops Zijie Zhao
2024-03-14 2:40 ` Kuppuswamy Sathyanarayanan
2024-03-14 6:19 ` Zijie Zhao [this message]
2024-03-14 6:45 ` Kuppuswamy Sathyanarayanan
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=20240314061945.1324128-1-zzjas98@gmail.com \
--to=zzjas98@gmail.com \
--cc=bhelgaas@google.com \
--cc=chenyuan0y@gmail.com \
--cc=linux-pci@vger.kernel.org \
--cc=sathyanarayanan.kuppuswamy@linux.intel.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).