浏览代码

fix the regression from "direct-io: Fix negative return from dio read beyond eof"

Sure, it's better to bail out of past-the-eof read and return 0 than return
a bogus negative value on such.  Only we'd better make sure we are bailing out
with 0 and not -ENOMEM...

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Al Viro 9 年之前
父节点
当前提交
2d4594acbf
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      fs/direct-io.c

+ 1 - 0
fs/direct-io.c

@@ -1175,6 +1175,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
 		if (dio->flags & DIO_LOCKING)
 		if (dio->flags & DIO_LOCKING)
 			mutex_unlock(&inode->i_mutex);
 			mutex_unlock(&inode->i_mutex);
 		kmem_cache_free(dio_cache, dio);
 		kmem_cache_free(dio_cache, dio);
+		retval = 0;
 		goto out;
 		goto out;
 	}
 	}