From: Simon Horman <horms@kernel.org>
To: Rao Shoaib <Rao.Shoaib@oracle.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, kuniyu@amazon.com, netdev@vger.kernel.org
Subject: Re: [PATCH v1] Remove zero length skb's when enqueuing new OOB
Date: Tue, 10 Sep 2024 14:44:51 +0100 [thread overview]
Message-ID: <20240910134451.GD572255@kernel.org> (raw)
In-Reply-To: <20240910002854.264192-1-Rao.Shoaib@oracle.com>
On Mon, Sep 09, 2024 at 05:28:54PM -0700, Rao Shoaib wrote:
> 13:03 Recent tests show that AF_UNIX socket code does not handle
> the following sequence properly
>
> Send OOB
> Read OOB
> Send OOB
> Read (Without OOB flag)
>
> The last read returns the OOB byte, which is incorrect.
> A following read with OOB flag returns EFAULT, which is also incorrect.
>
> In AF_UNIX, OOB byte is stored in a single skb, a pointer to the
> skb is stored in the linux socket (oob_skb) and the skb is linked
> in the socket's receive queue. Obviously, there are two refcnts on
> the skb.
>
> If the byte is read as an OOB, there will be no remaining data and
> regular read frees the skb in managge_oob() and moves to the next skb.
> The bug was that the next skb could be an OOB byte, but the code did
> not check that which resulted in a regular read, receiving the OOB byte.
>
> This patch adds code check the next skb obtained when a zero
> length skb is freed.
>
> The patch also adds code to check and remove an skb in front
> of about to be added OOB if it is a zero length skb.
>
> The cause of the last EFAULT was that the OOB byte had already been read
> by the regular read but oob_skb was not cleared. This resulted in
> __skb_datagram_iter() receiving a zero length skb to copy a byte from.
> So EFAULT was returned.
>
> Fixes: 314001f0bf92 ("af_unix: Add OOB support")
> Signed-off-by: Rao Shoaib <Rao.Shoaib@oracle.com>
Hi Rao,
This is not a proper review, I will leave that to Iwashima-san and others.
But I would like to note that as a fix for net it needs to be annotated as
such.
Subject: [PATCH net v1] ...
Unfortunately while the patch applies to net it does not apply to net-next.
But without the above annotation the CI did not know to apply the patch to
net. So the CI can't process this patch.
I suggest posting a v2, targeted at net, after waiting for a review from
Iwashima-san and others.
--
pw-bot: cr
next prev parent reply other threads:[~2024-09-10 13:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 0:28 [PATCH v1] Remove zero length skb's when enqueuing new OOB Rao Shoaib
2024-09-10 13:44 ` Simon Horman [this message]
2024-09-10 16:49 ` Shoaib Rao
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=20240910134451.GD572255@kernel.org \
--to=horms@kernel.org \
--cc=Rao.Shoaib@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 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).