@@ -2673,8 +2673,10 @@ static int io_read(struct io_kiocb *req,
if (req->file->f_op->read_iter)
ret2 = call_read_iter(req->file, kiocb, &iter);
- else
+ else if (req->file->f_op->read)
ret2 = loop_rw_iter(READ, req->file, kiocb, &iter);
+ else
+ ret2 = -EINVAL;
/* Catch -EAGAIN return for forced non-blocking submission */
if (!force_nonblock || ret2 != -EAGAIN) {
@@ -2788,8 +2790,10 @@ static int io_write(struct io_kiocb *req
if (req->file->f_op->write_iter)
ret2 = call_write_iter(req->file, kiocb, &iter);
- else
+ else if (req->file->f_op->write)
ret2 = loop_rw_iter(WRITE, req->file, kiocb, &iter);
+ else
+ ret2 = -EINVAL;
if (!force_nonblock)
current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;