--- a/drivers/dma-buf/udmabuf.c +++ u/drivers/dma-buf/udmabuf.c @@ -127,8 +127,11 @@ static int begin_cpu_udmabuf(struct dma_ if (!ubuf->sg) { ubuf->sg = get_sg_table(dev, buf, direction); - if (IS_ERR(ubuf->sg)) - return PTR_ERR(ubuf->sg); + if (IS_ERR(ubuf->sg)) { + int err = PTR_ERR(ubuf->sg); + ubuf->sg = NULL; + return err; + } } else { dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, direction);