From: Christian Schoenebeck <linux_oss@crudebyte.com>
To: "Guozihua (Scott)" <guozihua@huawei.com>, asmadeus@codewreck.org
Cc: ericvh@gmail.com, lucho@ionkov.net, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org
Subject: Re: [PATCH 0/3 v2] 9p: Fix write overflow in p9_read_work
Date: Fri, 18 Nov 2022 16:34:35 +0100 [thread overview]
Message-ID: <3743363.vbEDF3eA3V@silver> (raw)
In-Reply-To: <Y3ePOhpctTf7Buf8@codewreck.org>
On Friday, November 18, 2022 2:57:14 PM CET asmadeus@codewreck.org wrote:
> Guozihua (Scott) wrote on Fri, Nov 18, 2022 at 06:18:16PM +0800:
> > I retried the repro on your branch, the issue does not reproduce. What
> > a good pair of eyes :)!
>
> Thanks!
> By the way the original check also compared size to msize directly,
> without an offset for headers, so with hindsight it looks clear enough
> that the size is the full size including the header.
>
> I'm not sure why I convinced myself it didn't...
>
> Anyway, this made me check other places where we might fail at this and
> I've a couple more patches; please review if you have time.
> I'll send them all to Linus next week...
>
Aah, the offset is already incremented before that block is entered:
303 err = p9_fd_read(m->client, m->rc.sdata + m->rc.offset,
304 m->rc.capacity - m->rc.offset);
...
312 m->rc.offset += err;
313
314 /* header read in */
315 if ((!m->rreq) && (m->rc.offset == m->rc.capacity)) {
And the data is then copied to m->rreq->rc.sdata without any offset. So yes,
there should be no `offset` in the check.
Best regards,
Christian Schoenebeck
prev parent reply other threads:[~2022-11-18 15:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 9:11 [PATCH 0/3 v2] 9p: Fix write overflow in p9_read_work GUO Zihua
2022-11-17 9:11 ` [PATCH 1/3 " GUO Zihua
2022-11-17 9:11 ` [PATCH 2/3 v2] 9p: Remove redundent checks for message size against msize GUO Zihua
2022-11-17 9:11 ` [PATCH 3/3 v2] 9p: Use P9_HDRSZ for header size GUO Zihua
2022-11-17 10:49 ` [PATCH 0/3 v2] 9p: Fix write overflow in p9_read_work asmadeus
2022-11-17 10:54 ` Guozihua (Scott)
2022-11-17 13:33 ` Christian Schoenebeck
2022-11-18 4:59 ` asmadeus
2022-11-18 10:18 ` Guozihua (Scott)
2022-11-18 13:57 ` asmadeus
2022-11-18 15:34 ` Christian Schoenebeck [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=3743363.vbEDF3eA3V@silver \
--to=linux_oss@crudebyte.com \
--cc=asmadeus@codewreck.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ericvh@gmail.com \
--cc=guozihua@huawei.com \
--cc=kuba@kernel.org \
--cc=lucho@ionkov.net \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=v9fs-developer@lists.sourceforge.net \
/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.