[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADvbK_fTmu4MWdwk5uTd_FEnny=_=OD=iqrq-3McQ5mgw1JnKg@mail.gmail.com>
Date: Wed, 3 Nov 2021 08:43:45 -0400
From: Xin Long <lucien.xin@...il.com>
To: Alexey Khoroshilov <khoroshilov@...ras.ru>
Cc: Vlad Yasevich <vyasevich@...il.com>,
Neil Horman <nhorman@...driver.com>,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
"linux-sctp @ vger . kernel . org" <linux-sctp@...r.kernel.org>,
network dev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, ldv-project@...uxtesting.org
Subject: Re: [PATCH] sctp: avoid NULL pointer dereference in sctp_sf_violation
On Tue, Nov 2, 2021 at 4:27 PM Alexey Khoroshilov <khoroshilov@...ras.ru> wrote:
>
> Some callers (e.g. sctp_sf_violation_chunk) passes NULL to
> asoc argument of sctp_sf_violation. So, it should check it
> before calling sctp_vtag_verify().
>
> Probably it could be exploited by a malicious SCTP packet
> to cause NULL pointer dereference.
I don't think asoc can be NULL in here, did you see any call trace
caused by it?
If this was found by a tool, please remove the unnecessary call from
sctp_sf_violation_chunk() instead:
@@ -4893,9 +4893,6 @@ static enum sctp_disposition sctp_sf_violation_chunk(
{
static const char err_str[] = "The following chunk violates protocol:";
- if (!asoc)
- return sctp_sf_violation(net, ep, asoc, type, arg, commands);
-
Thanks.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
> Fixes: aa0f697e4528 ("sctp: add vtag check in sctp_sf_violation")
> ---
> net/sctp/sm_statefuns.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index fb3da4d8f4a3..77f3cd6c516e 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -4669,7 +4669,7 @@ enum sctp_disposition sctp_sf_violation(struct net *net,
> {
> struct sctp_chunk *chunk = arg;
>
> - if (!sctp_vtag_verify(chunk, asoc))
> + if (asoc && !sctp_vtag_verify(chunk, asoc))
> return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
>
> /* Make sure that the chunk has a valid length. */
> --
> 2.7.4
>
Powered by blists - more mailing lists