diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2022-11-08 17:05:59 -0600 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2022-11-09 16:57:29 -0600 |
commit | aa382ffa705bea9931ec92b6f3c70e1fdb372195 (patch) | |
tree | a69627409a451028d100ef6b346027d6befb7a60 /drivers/pci/slot.c | |
parent | 9abf2313adc1ca1b6180c508c25f22f9395cc780 (diff) |
PCI/sysfs: Fix double free in error path
When pci_create_attr() fails, pci_remove_resource_files() is called which
will iterate over the res_attr[_wc] arrays and frees every non NULL entry.
To avoid a double free here set the array entry only after it's clear we
successfully initialized it.
Fixes: b562ec8f74e4 ("PCI: Don't leak memory if sysfs_create_bin_file() fails")
Link: https://lore.kernel.org/r/20221007070735.GX986@pengutronix.de/
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/pci/slot.c')
0 files changed, 0 insertions, 0 deletions