lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+6hz4rWLM_LkABr_cegdx66V2BBsR2Z7NuTMaDuBH2KZdOTSA@mail.gmail.com>
Date:   Thu, 3 Nov 2016 08:52:22 +0800
From:   Gao Feng <fgao@...ai8.com>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     David Miller <davem@...emloft.net>,
        Cong Wang <cwang@...pensource.com>,
        Vijay Pandurangan <vijayp@...ayp.ca>,
        Evan Jones <ej@...njones.ca>, pabeni@...hat.com,
        Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [PATCH net 1/1] driver: veth: Return the actual value instead
 return NETDEV_TX_OK always

Hi Cong,

On Thu, Nov 3, 2016 at 4:22 AM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Wed, Nov 2, 2016 at 2:59 AM,  <fgao@...ai8.com> wrote:
>> From: Gao Feng <fgao@...ai8.com>
>>
>> Current veth_xmit always returns NETDEV_TX_OK whatever if it is really
>> sent successfully. Now return the actual value instead of NETDEV_TX_OK
>> always.
>>
>> Signed-off-by: Gao Feng <fgao@...ai8.com>
>> ---
>>  drivers/net/veth.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
>> index fbc853e..769a3bd 100644
>> --- a/drivers/net/veth.c
>> +++ b/drivers/net/veth.c
>> @@ -111,15 +111,18 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
>>         struct veth_priv *priv = netdev_priv(dev);
>>         struct net_device *rcv;
>>         int length = skb->len;
>> +       int ret = NETDEV_TX_OK;
>>
>>         rcu_read_lock();
>>         rcv = rcu_dereference(priv->peer);
>>         if (unlikely(!rcv)) {
>>                 kfree_skb(skb);
>> +               ret = NET_RX_DROP;
>
>
> Returning NET_RX_DROP doesn't look correct in a xmit function.

Yes. But I don't find good macro.
NETDEV_TX_BUSY or NET_RX_DROP, which is better ?

Thanks
Feng

>
>
>>                 goto drop;
>>         }
>>
>> -       if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) {
>> +       ret = dev_forward_skb(rcv, skb);
>> +       if (likely(ret == NET_RX_SUCCESS)) {
>>                 struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats);
>>
>>                 u64_stats_update_begin(&stats->syncp);
>> @@ -131,7 +134,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
>>                 atomic64_inc(&priv->dropped);
>>         }
>>         rcu_read_unlock();
>> -       return NETDEV_TX_OK;
>> +       return ret;
>>  }
>>
>>  /*
>> --
>> 1.9.1
>>
>>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ