DmaBufAllocator: Avoid syncing with an invalid file descriptor
As DmaSyncer disables the copy c'tor, the move c'tor will be used
instead. This leaves some DmaSyncers with invalid SharedFDs. They should
avoid syncing with invalid file descriptors in the d'tor.
Fixes: 545046a41e
("DmaBufAllocator: Make DmaSyncer non-copyable")
Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
Tested-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
8b35ce4753
commit
4dad8ece72
1 changed files with 6 additions and 1 deletions
|
@ -325,7 +325,12 @@ DmaSyncer::DmaSyncer(SharedFD fd, SyncType type)
|
|||
|
||||
DmaSyncer::~DmaSyncer()
|
||||
{
|
||||
sync(DMA_BUF_SYNC_END);
|
||||
/*
|
||||
* DmaSyncer might be moved and left with an empty SharedFD.
|
||||
* Avoid syncing with an invalid file descriptor in this case.
|
||||
*/
|
||||
if (fd_.isValid())
|
||||
sync(DMA_BUF_SYNC_END);
|
||||
}
|
||||
|
||||
void DmaSyncer::sync(uint64_t step)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue