The code did not release the handle private data mutex correctly if it
failed to pin the handle. This lead to deadlock when we later tried to
pin/unpin the same handle.
Bug
1408131
Change-Id: Ie14abf63f81190fd12c176c74d81af2f96e014b2
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/350631
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
if (IS_ERR(as_priv->sgt)) {
sgt = as_priv->sgt;
as_priv->sgt = NULL;
+ mutex_unlock(&priv->lock);
return sgt;
}
}
} else if (as_priv->pin_count == 0) {
as_priv->attach = dma_buf_attach(dmabuf, dev);
- if (IS_ERR(as_priv->attach))
+ if (IS_ERR(as_priv->attach)) {
+ mutex_unlock(&priv->lock);
return (struct sg_table *)as_priv->attach;
+ }
as_priv->sgt = dma_buf_map_attachment(as_priv->attach,
DMA_BIDIRECTIONAL);
if (IS_ERR(as_priv->sgt)) {
dma_buf_detach(dmabuf, as_priv->attach);
+ mutex_unlock(&priv->lock);
return as_priv->sgt;
}
}