Skip to content

Commit

Permalink
Return -ENOMEM when a write is requested but insufficent space exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
dacut committed Jun 13, 2016
1 parent 246c389 commit c767011
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ublkdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,12 +960,13 @@ static long ubdctl_ioctl_getrequest(
if (write_size > msg.ubd_size) {
ubd_warning("Insufficient buffer space: need %u bytes; userspace "
"provided only %u bytes.", write_size, msg.ubd_size);
msg.ubd_size = write_size;
spin_unlock_irqrestore(&dev->wait.lock, lock_flags);
return write_size;
return -ENOMEM;
}

msg.ubd_msgtype = UBD_MSGTYPE_WRITE;
msg.ubd_size = msg.ubd_nsectors << 9;
msg.ubd_size = write_size;

// Copy the data from the write request over to the userspace buffer.
rq_for_each_segment(bvec, req, iter) {
Expand Down

0 comments on commit c767011

Please sign in to comment.