From: Al Viro Date: Tue, 8 Dec 2015 17:22:47 +0000 (-0500) Subject: fix the regression from "direct-io: Fix negative return from dio read beyond eof" X-Git-Tag: v4.1.12-92~150^2~336 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=06254faae3c968d67a34961fdff0c800015d81d8;p=users%2Fjedix%2Flinux-maple.git fix the regression from "direct-io: Fix negative return from dio read beyond eof" Orabug: stable_rc4 commit 2d4594acbf6d8f75a27f3578476b6a27d8b13ebb upstream. 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... Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 57b7d61c2d89e3e0665b9cdcc8fb73b08d10f0c2) Signed-off-by: Dan Duval --- diff --git a/fs/direct-io.c b/fs/direct-io.c index 6bc4bacd89843..d83a021a659fd 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -1165,6 +1165,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, if (dio->flags & DIO_LOCKING) mutex_unlock(&inode->i_mutex); kmem_cache_free(dio_cache, dio); + retval = 0; goto out; }