All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Christian Schoenebeck <linux_oss@crudebyte.com>
Cc: Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
	Robert Morris <rtm@mit.edu>
Subject: Re: [PATCH] 9p/net: fix improper handling of bogus negative read/write replies
Date: Mon, 17 Mar 2025 06:37:13 +0900	[thread overview]
Message-ID: <Z9dEiQUyDtf7nx0e@codewreck.org> (raw)
In-Reply-To: <4171850.H1WhmIdAfj@silver>

Christian Schoenebeck wrote on Sun, Dec 22, 2024 at 04:29:58PM +0100:
> > @@ -1592,11 +1593,11 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to,
> >  		return 0;
> >  	}
> >  	if (rsize < received) {
> > -		pr_err("bogus RREAD count (%d > %d)\n", received, rsize);
> > +		pr_err("bogus RREAD count (%u > %u)\n", received, rsize);
> >  		received = rsize;
> 
> Does `received = rsize` make sense here? I would rather do `received = 0` to
> prevent copying garbage below, that would be ignored by caller on error case
> anyway.

Good point.. We're not setting *err here so this isn't an error (and
thus not ignored), so I guess it sort of makes sense if you look at it
from a "best effort" point of view, but I agree a bogus reply probably
better return an error.

OTOH it's a change of behaviour so I'd rather have it in another patch,
will send separately.

> > @@ -1623,9 +1624,9 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)
> >  	*err = 0;
> >  
> >  	while (iov_iter_count(from)) {
> > -		int count = iov_iter_count(from);
> > -		int rsize = fid->iounit;
> > -		int written;
> > +		size_t count = iov_iter_count(from);
> > +		size_t rsize = fid->iounit;
> 
> I think that would break 64-bit big-endian systems, as `rsize` is passed via
> format below as "d" (32-bit) type.

Good catch, thanks!
-- 
Dominique Martinet | Asmadeus

      reply	other threads:[~2025-03-16 21:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-22 13:57 [PATCH] 9p/net: fix improper handling of bogus negative read/write replies Dominique Martinet
2024-12-22 15:29 ` Christian Schoenebeck
2025-03-16 21:37   ` Dominique Martinet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z9dEiQUyDtf7nx0e@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=rtm@mit.edu \
    --cc=v9fs@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.