linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/9p: fix readdir()
@ 2015-04-22  9:55 Johannes Berg
  2015-04-22 13:43 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2015-04-22  9:55 UTC (permalink / raw)
  To: viro, linux-kernel; +Cc: j, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Al Viro's IOV changes broke 9p readdir() because the new code
didn't abort the read when it returned nothing. The original
code checked if the combined error/length was <= 0 but in the
new code that accidentally got changed to just an error check.

Add back the return from the function when nothing is read.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Fixes: e1200fe68f20 ("9p: switch p9_client_read() to passing struct iov_iter *")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 fs/9p/vfs_dir.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 76c3b1ab6361..5cc00e56206e 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -138,6 +138,8 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx)
 					   &err);
 			if (err)
 				return err;
+			if (n == 0)
+				return 0;
 
 			rdir->head = 0;
 			rdir->tail = n;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/9p: fix readdir()
  2015-04-22  9:55 [PATCH] fs/9p: fix readdir() Johannes Berg
@ 2015-04-22 13:43 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2015-04-22 13:43 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-kernel, j, Johannes Berg

On Wed, Apr 22, 2015 at 11:55:14AM +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> Al Viro's IOV changes broke 9p readdir() because the new code
> didn't abort the read when it returned nothing. The original
> code checked if the combined error/length was <= 0 but in the
> new code that accidentally got changed to just an error check.
> 
> Add back the return from the function when nothing is read.

Nice catch...  FWIW, this hadn't been caught since it doesn't trigger
on 9P.L tests.  Applied, and testing setup fixed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-22 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22  9:55 [PATCH] fs/9p: fix readdir() Johannes Berg
2015-04-22 13:43 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).