[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5KErK9c3Nafn45V@x130>
Date: Thu, 8 Dec 2022 16:43:24 -0800
From: Saeed Mahameed <saeed@...nel.org>
To: Gerhard Engleder <gerhard@...leder-embedded.com>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org, davem@...emloft.net,
kuba@...nel.org, edumazet@...gle.com, pabeni@...hat.com,
ast@...nel.org, daniel@...earbox.net, hawk@...nel.org,
john.fastabend@...il.com
Subject: Re: [PATCH net-next v2 3/6] tsnep: Support XDP BPF program setup
On 08 Dec 06:40, Gerhard Engleder wrote:
>Implement setup of BPF programs for XDP RX path with command
>XDP_SETUP_PROG of ndo_bpf(). This is prework for XDP RX path support.
>
>Signed-off-by: Gerhard Engleder <gerhard@...leder-embedded.com>
[ ... ]
>+int tsnep_xdp_setup_prog(struct tsnep_adapter *adapter, struct bpf_prog *prog,
>+ struct netlink_ext_ack *extack)
>+{
>+ struct net_device *dev = adapter->netdev;
>+ bool if_running = netif_running(dev);
>+ struct bpf_prog *old_prog;
>+
>+ if (if_running)
>+ tsnep_netdev_close(dev);
>+
>+ old_prog = xchg(&adapter->xdp_prog, prog);
>+ if (old_prog)
>+ bpf_prog_put(old_prog);
>+
>+ if (if_running)
>+ tsnep_netdev_open(dev);
this could fail silently, and then cause double free, when close ndo
will be called, the stack won't be aware of the closed state..
Powered by blists - more mailing lists