[Devel,RHEL7,COMMIT] fence-watchdog: fix return format in dev_hard_start_xmit

Submitted by Kirill Tkhai on Sept. 19, 2016, 12:50 p.m.

Details

Message ID 201609191250.u8JCoCvb027634@pro
State New
Series "fence-watchdog: fix return format in dev_hard_start_xmit"
Headers show

Commit Message

Kirill Tkhai Sept. 19, 2016, 12:50 p.m.
The commit is pushed to "branch-rh7-3.10.0-327.28.2.vz7.17.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.28.2.vz7.17.7
------>
commit 8ed540dea33548976602b337051ca0955ecc9873
Author: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Date:   Mon Sep 19 15:49:11 2016 +0300

    fence-watchdog: fix return format in dev_hard_start_xmit
    
    Status goes in ret, before fix status remained -ENOMEM
    and was returned from dev_queue_xmit, that is not desired
    behaviour - we want to drop packet silently and say
    NETDEV_TX_OK(that it was sent).
    
    Return NULL, before the fix we were very lucky that in
    dev_queue_xmit, we do not get to kfree_skb_list(-ENOMEM),
    as dev_xmit_complete(-ENOMEM) is true =)
    
    In both sch_direct_xmit and dev_queue_xmit we will
    never use returned value of dev_hard_start_xmit in
    case of fencing so it is safe to return NULL here.
    
    https://jira.sw.ru/browse/PSBM-50006
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 net/core/dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/net/core/dev.c b/net/core/dev.c
index be92f4f..0137947 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2559,7 +2559,8 @@  struct sk_buff *dev_hard_start_xmit(struct sk_buff *first, struct net_device *de
 #ifdef CONFIG_FENCE_WATCHDOG
 	if (unlikely(fence_wdog_check_timer())) {
 		kfree_skb(skb);
-		return NETDEV_TX_OK;
+		*ret = rc;
+		return NULL;
 	}
 #endif