diff options
| author | Sascha Hauer <s.hauer@pengutronix.de> | 2022-11-08 17:05:59 -0600 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-07 11:11:53 +0100 |
| commit | b33528863d07e7f6619264f3ce774ae414027fce (patch) | |
| tree | adf4323ce76435abc2e160d878f34f7659d16e62 /arch | |
| parent | 518573988a2f14f517403db2ece5ddaefba21e94 (diff) | |
| download | linux-b33528863d07e7f6619264f3ce774ae414027fce.tar.gz linux-b33528863d07e7f6619264f3ce774ae414027fce.tar.bz2 linux-b33528863d07e7f6619264f3ce774ae414027fce.zip | |
PCI/sysfs: Fix double free in error path
commit aa382ffa705bea9931ec92b6f3c70e1fdb372195 upstream.
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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
0 files changed, 0 insertions, 0 deletions
