From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
lorenzo.bianconi@redhat.com, brouer@redhat.com
Subject: Re: [PATCH net 1/2] net: socionext: fix possible user-after-free in netsec_process_rx
Date: Mon, 27 Jan 2020 10:01:24 +0200 [thread overview]
Message-ID: <20200127080124.GA24434@apalos.home> (raw)
In-Reply-To: <b66c3b2603da49706597d84aacb7ac8b4ffb1820.1579952387.git.lorenzo@kernel.org>
On Sat, Jan 25, 2020 at 12:48:50PM +0100, Lorenzo Bianconi wrote:
> Fix possible use-after-free in in netsec_process_rx that can occurs if
> the first packet is sent to the normal networking stack and the
> following one is dropped by the bpf program attached to the xdp hook.
> Fix the issue defining the skb pointer in the 'budget' loop
>
> Fixes: ba2b232108d3c ("net: netsec: add XDP support")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> drivers/net/ethernet/socionext/netsec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
> index 869a498e3b5e..0e12a9856aea 100644
> --- a/drivers/net/ethernet/socionext/netsec.c
> +++ b/drivers/net/ethernet/socionext/netsec.c
> @@ -929,7 +929,6 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget)
> struct netsec_rx_pkt_info rx_info;
> enum dma_data_direction dma_dir;
> struct bpf_prog *xdp_prog;
> - struct sk_buff *skb = NULL;
> u16 xdp_xmit = 0;
> u32 xdp_act = 0;
> int done = 0;
> @@ -943,6 +942,7 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget)
> struct netsec_de *de = dring->vaddr + (DESC_SZ * idx);
> struct netsec_desc *desc = &dring->desc[idx];
> struct page *page = virt_to_page(desc->addr);
> + struct sk_buff *skb = NULL;
> u32 xdp_result = XDP_PASS;
> u16 pkt_len, desc_len;
> dma_addr_t dma_handle;
> --
> 2.21.1
>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
next prev parent reply other threads:[~2020-01-27 8:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-25 11:48 [PATCH net 0/2] XDP fixes for socionext driver Lorenzo Bianconi
2020-01-25 11:48 ` [PATCH net 1/2] net: socionext: fix possible user-after-free in netsec_process_rx Lorenzo Bianconi
2020-01-25 12:45 ` Jesper Dangaard Brouer
2020-01-27 8:01 ` Ilias Apalodimas [this message]
2020-01-25 11:48 ` [PATCH net 2/2] net: socionext: fix xdp_result initialization " Lorenzo Bianconi
2020-01-25 12:50 ` Jesper Dangaard Brouer
2020-01-27 8:01 ` Ilias Apalodimas
2020-01-27 10:08 ` [PATCH net 0/2] XDP fixes for socionext driver David Miller
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=20200127080124.GA24434@apalos.home \
--to=ilias.apalodimas@linaro.org \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=lorenzo.bianconi@redhat.com \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
/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).