OSDN Git Service

xen/gntdev: don't dereference a null gntdev_dmabuf on allocation failure
authorColin Ian King <colin.king@canonical.com>
Tue, 31 Jul 2018 14:02:25 +0000 (15:02 +0100)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Tue, 31 Jul 2018 16:59:13 +0000 (12:59 -0400)
commit2789e83c933d7da583e592d7958e87493c889605
tree0b8684759ec73bf0125293bb2fd884ba050646d5
parent47b428d14f06dbeab23dd5c7e424e15283841765
xen/gntdev: don't dereference a null gntdev_dmabuf on allocation failure

Currently when the allocation of gntdev_dmabuf fails, the error exit
path will call dmabuf_imp_free_storage and causes a null pointer
dereference on gntdev_dmabuf.  Fix this by adding an error exit path
that won't free gntdev_dmabuf.

Detected by CoverityScan, CID#1472124 ("Dereference after null check")

Fixes: bf8dc55b1358 ("xen/gntdev: Implement dma-buf import functionality")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/gntdev-dmabuf.c