[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7bd4c51e-304d-575f-84df-2ec5b52a885b@engleder-embedded.com>
Date: Wed, 21 Dec 2022 21:19:27 +0100
From: Gerhard Engleder <gerhard@...leder-embedded.com>
To: Saeed Mahameed <saeed@...nel.org>
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 09.12.22 09:06, Gerhard Engleder wrote:
> On 09.12.22 01:43, Saeed Mahameed wrote:
>>> +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..
>
> I will ensure that no double free will happen when ndo_close is called.
Other drivers like igc/igb/netsec/stmmac also fail silently and
I don't see any measures against double free in this drivers.
mvneta forwards the return value of open. How are these drivers
solving this issue? I cannot find this detail, but I also do not
believe that all this drivers are buggy.
gerhard
Powered by blists - more mailing lists