summaryrefslogtreecommitdiffstats
path: root/drivers/cdx/controller/cdx_controller.c
diff options
context:
space:
mode:
authorTodd Kjos <tkjos@google.com>2024-10-01 23:11:47 +0000
committerBjorn Helgaas <bhelgaas@google.com>2024-10-02 16:36:35 -0500
commit2985b1844f3f3447f2d938eff1ef6762592065a5 (patch)
tree9d96384fd76542bbb4d44a03cce7e613e0c1a10a /drivers/cdx/controller/cdx_controller.c
parent43ee11adcb940204948ac0ca3a05d6178f0e8b08 (diff)
downloadlinux-2985b1844f3f3447f2d938eff1ef6762592065a5.tar.gz
linux-2985b1844f3f3447f2d938eff1ef6762592065a5.tar.bz2
linux-2985b1844f3f3447f2d938eff1ef6762592065a5.zip
PCI: Fix reset_method_store() memory leak
In reset_method_store(), a string is allocated via kstrndup() and assigned to the local "options". options is then used in with strsep() to find spaces: while ((name = strsep(&options, " ")) != NULL) { If there are no remaining spaces, then options is set to NULL by strsep(), so the subsequent kfree(options) doesn't free the memory allocated via kstrndup(). Fix by using a separate tmp_options to iterate with strsep() so options is preserved. Link: https://lore.kernel.org/r/20241001231147.3583649-1-tkjos@google.com Fixes: d88f521da3ef ("PCI: Allow userspace to query and set device reset mechanism") Signed-off-by: Todd Kjos <tkjos@google.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/cdx/controller/cdx_controller.c')
0 files changed, 0 insertions, 0 deletions