mirror of
https://github.com/torvalds/linux
synced 2024-10-27 21:59:21 +00:00
staging/vme_user: fix usage of the slave resources after they've been freed
buf_unalloc() frees the memory buffers allocated with vme_alloc_consistent. The associated VME resource is needed in both vme_alloc_consistent and vme_free_consistent; however the slave VME resources are being freed before the calls to vme_free_consistent are made, which means the buffers are never returned. Fix this by freeing the VME resources only after the consistent buffers have been returned. Signed-off-by: Emilio G. Cota <cota@braap.org> Acked-by: Martyn Welch <martyn.welch@ge.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
d5c21fc615
commit
1daa38d379
|
@ -829,8 +829,8 @@ static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot)
|
||||||
err_slave:
|
err_slave:
|
||||||
while (i > SLAVE_MINOR) {
|
while (i > SLAVE_MINOR) {
|
||||||
i--;
|
i--;
|
||||||
vme_slave_free(image[i].resource);
|
|
||||||
buf_unalloc(i);
|
buf_unalloc(i);
|
||||||
|
vme_slave_free(image[i].resource);
|
||||||
}
|
}
|
||||||
err_class:
|
err_class:
|
||||||
cdev_del(vme_user_cdev);
|
cdev_del(vme_user_cdev);
|
||||||
|
@ -855,8 +855,8 @@ static int __exit vme_user_remove(struct device *dev, int cur_bus, int cur_slot)
|
||||||
|
|
||||||
for (i = SLAVE_MINOR; i < (SLAVE_MAX + 1); i++) {
|
for (i = SLAVE_MINOR; i < (SLAVE_MAX + 1); i++) {
|
||||||
vme_slave_set(image[i].resource, 0, 0, 0, 0, VME_A32, 0);
|
vme_slave_set(image[i].resource, 0, 0, 0, 0, VME_A32, 0);
|
||||||
vme_slave_free(image[i].resource);
|
|
||||||
buf_unalloc(i);
|
buf_unalloc(i);
|
||||||
|
vme_slave_free(image[i].resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unregister device driver */
|
/* Unregister device driver */
|
||||||
|
|
Loading…
Reference in a new issue