[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210819121630.1223327f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Thu, 19 Aug 2021 12:16:30 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: butt3rflyh4ck <butterflyhuangxx@...il.com>
Cc: mani@...nel.org, davem@...emloft.net,
linux-arm-msm@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
butt3rflyh4ck <butterflyhhuangxx@...il.com>,
bjorn.andersson@...aro.org, paskripkin@...il.com
Subject: Re: [PATCH] net: qrtr: fix another OOB Read in qrtr_endpoint_post
On Fri, 20 Aug 2021 02:14:58 +0800 butt3rflyh4ck wrote:
> From: butt3rflyh4ck <butterflyhhuangxx@...il.com>
>
> This check was incomplete, did not consider size is 0:
>
> if (len != ALIGN(size, 4) + hdrlen)
> goto err;
>
> if size from qrtr_hdr is 0, the result of ALIGN(size, 4)
> will be 0, In case of len == hdrlen and size == 0
> in header this check won't fail and
>
> if (cb->type == QRTR_TYPE_NEW_SERVER) {
> /* Remote node endpoint can bridge other distant nodes */
> const struct qrtr_ctrl_pkt *pkt = data + hdrlen;
>
> qrtr_node_assign(node, le32_to_cpu(pkt->server.node));
> }
>
> will also read out of bound from data, which is hdrlen allocated block.
>
> Fixes: 194ccc88297a ("net: qrtr: Support decoding incoming v2 packets")
> Fixes: ad9d24c9429e ("net: qrtr: fix OOB Read in qrtr_endpoint_post")
Please make sure to CC authors of patches which are under Fixes, they
are usually the best people to review the patch. Adding them now.
> Signed-off-by: butt3rflyh4ck <butterflyhhuangxx@...il.com>
We'll need your name. AFAIU it's because of Developer Certificate of
Origin. You'll need to resend with this fixed (and please remember the CCs).
> diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
> index 171b7f3be6ef..0c30908628ba 100644
> --- a/net/qrtr/qrtr.c
> +++ b/net/qrtr/qrtr.c
> @@ -493,7 +493,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
> goto err;
> }
>
> - if (len != ALIGN(size, 4) + hdrlen)
> + if (!size || len != ALIGN(size, 4) + hdrlen)
> goto err;
>
> if (cb->dst_port != QRTR_PORT_CTRL && cb->type != QRTR_TYPE_DATA &&
Powered by blists - more mailing lists