drm: Fix missing unlock and free on error in drm_legacy_addbufs_pci()
Subsystems (2)
PATCH 1/1 drm: Fix missing unlock and free on error in drm_legacy_addbufs_pci()
Add the missing unlock and free before return from function drm_legacy_addbufs_pci() in the error handling case.
Fixes 70556e24e18e ("drm: remove usage of drm_pci_alloc/free")
Reported-by Hulk Robot <[email protected]>
Signed-off-by Zou Wei <[email protected]>
--- drivers/gpu/drm/drm_bufs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_bufs.c +9 -1
@@ -984,8 +984,16 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,while (entry->buf_count < count) { dmah =kmalloc (sizeof (drm_dma_handle_t),GFP_KERNEL ); -if (!dmah) +if (!dmah) { +/* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + entry->seg_count = count; +drm_cleanup_buf_error (dev, entry); +kfree (temp_pagelist); +mutex_unlock (&dev->struct_mutex); +atomic_dec (&dev->buf_alloc);return -ENOMEM ; + } dmah->size = total; dmah->vaddr = dma_alloc_coherent(dev->dev,
Signature · 1 line
2.6.2
Daniel Vetter
AppliedQuoted 6 lines · Zou Wei
Add the missing unlock and free before return from function
drm_legacy_addbufs_pci()in the error handling case.Fixes 70556e24e18e ("drm: remove usage of drm_pci_alloc/free")Reported-by Hulk Robot <[email protected]>Signed-off-by Zou Wei <[email protected]>
Applied to drm-misc-next, thanks for your patch.
-Daniel
Quoted 29 lines
--- drivers/gpu/drm/drm_bufs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_bufs.c +9
-1@@ -984,8 +984,16 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,while (entry->buf_count < count) { dmah =kmalloc (sizeof (drm_dma_handle_t),GFP_KERNEL ); -if (!dmah) +if (!dmah) { +/* Set count correctly so we free the proper amount. */ + entry->buf_count = count; + entry->seg_count = count; +drm_cleanup_buf_error (dev, entry); +kfree (temp_pagelist); +mutex_unlock (&dev->struct_mutex); +atomic_dec (&dev->buf_alloc);return -ENOMEM ; + } dmah->size = total; dmah->vaddr = dma_alloc_coherent(dev->dev,Signature · 1 line
2.6.2
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch