]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Phonet: restore flow control credits when sending fails
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Mon, 30 Aug 2010 12:57:03 +0000 (12:57 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 31 Aug 2010 20:04:32 +0000 (13:04 -0700)
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/phonet/pep.c

index b2a3ae6cad78e28324e23b857dc0a5773f569786..5034f0f62bdb7e3ae8e20227975e5986c14e6270 100644 (file)
@@ -834,6 +834,7 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb)
 {
        struct pep_sock *pn = pep_sk(sk);
        struct pnpipehdr *ph;
+       int err;
 
        if (pn_flow_safe(pn->tx_fc) &&
            !atomic_add_unless(&pn->tx_credits, -1, 0)) {
@@ -852,7 +853,10 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb)
                ph->message_id = PNS_PIPE_DATA;
        ph->pipe_handle = pn->pipe_handle;
 
-       return pn_skb_send(sk, skb, &pipe_srv);
+       err = pn_skb_send(sk, skb, &pipe_srv);
+       if (err && pn_flow_safe(pn->tx_fc))
+               atomic_inc(&pn->tx_credits);
+       return err;
 }
 
 static int pep_sendmsg(struct kiocb *iocb, struct sock *sk,