forked from MIrrors/gasket-driver
staging: gasket: avoid copy to user on error in coherent alloc config
gasket_config_coherent_allocator() on error return the error to caller without copying a possibly-update DMA address back to userspace. Reported-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Alex Van Damme
parent
98e0a3cbf4
commit
0087db424a
@@ -441,8 +441,10 @@ static int gasket_config_coherent_allocator(
|
|||||||
gasket_dev, ibuf.size, &ibuf.dma_address,
|
gasket_dev, ibuf.size, &ibuf.dma_address,
|
||||||
ibuf.page_table_index);
|
ibuf.page_table_index);
|
||||||
}
|
}
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
if (copy_to_user(argp, &ibuf, sizeof(ibuf)))
|
if (copy_to_user(argp, &ibuf, sizeof(ibuf)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user