summary refs log tree commit diff
path: root/drivers/ata/pata_pdc2027x.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2015-01-21 11:50:52 +0100
committerTejun Heo <tj@kernel.org>2015-01-21 11:21:38 -0500
commit552941503b9500a99be06cc9f60348099435b160 (patch)
treeec23e1e3f24255b5e63503e0f5e9a2411961267e /drivers/ata/pata_pdc2027x.c
parentc7d7ddee7e24eedde6149eefbcfbfbc7125b9ff0 (diff)
downloadlinux-552941503b9500a99be06cc9f60348099435b160.tar.gz
ata: libahci: Fix devres cleanup on failure
Commit c7d7ddee7e24 ("ata: libahci: Allow using multiple regulators")
releases regulators during ahci_platform_put_resources(). That doesn't
work because the function is run as part of the devres machinery. Such
resources are torn down in reverse order. Since the array that holds
pointers to the regulators is allocated using devres after the device
context to which ahci_platform_put_resources() is attached, the memory
will be freed before calling ahci_platform_put_resources() and thereby
causing a use-after-free error.

This commit fixes this by using regular allocations for the array. The
memory can then be freed after the regulators have been released. This
conserves the advantages of using the managed API.

Reported-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/pata_pdc2027x.c')
0 files changed, 0 insertions, 0 deletions