From f08c584ca1f393f6559b58b6b4c9e259c313259e Mon Sep 17 00:00:00 2001 From: Jason Luan Date: Tue, 15 Oct 2013 17:07:49 +0800 Subject: [PATCH] Process the wrong judge of time_after_eq(). If netfront send lesser package, the delta between now and next_credit will be out range of time_after_qe() and the function will do wrong judge. Because the expires always after jiffies, we judge the condition by time_before(now, vif->credit_timeout.expires). Signed-off-by: Jason Luan --- drivers/net/xen-netback/netback.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index f3e591c..8036ce6 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c @@ -1195,7 +1195,8 @@ static bool tx_credit_exceeded(struct xenvif *vif, unsigned size) return true; /* Passed the point where we can replenish credit? */ - if (time_after_eq(now, next_credit)) { + if (time_after_eq(now, next_credit) || + unlikely(time_before(now, vif->credit_timeout.expires))) { vif->credit_timeout.expires = now; tx_add_credit(vif); } -- 1.7.6.5