projects
/
platform
/
kernel
/
linux-amlogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9d88b93
)
PCI: Don't leak memory if sysfs_create_bin_file() fails
author
Bjorn Helgaas
<bhelgaas@google.com>
Thu, 10 Mar 2016 20:36:28 +0000
(14:36 -0600)
committer
Bjorn Helgaas
<bhelgaas@google.com>
Sat, 12 Mar 2016 12:00:29 +0000
(06:00 -0600)
If sysfs_create_bin_file() fails, pci_create_attr() leaks the struct
bin_attribute it allocated previously.
Free the struct bin_attribute if pci_create_attr() fails.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci-sysfs.c
patch
|
blob
|
history
diff --git
a/drivers/pci/pci-sysfs.c
b/drivers/pci/pci-sysfs.c
index
4ca8af3
..
847a973
100644
(file)
--- a/
drivers/pci/pci-sysfs.c
+++ b/
drivers/pci/pci-sysfs.c
@@
-1159,6
+1159,8
@@
static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine)
res_attr->size = pci_resource_len(pdev, num);
res_attr->private = &pdev->resource[num];
retval = sysfs_create_bin_file(&pdev->dev.kobj, res_attr);
+ if (retval)
+ kfree(res_attr);
} else
retval = -ENOMEM;