diff options
author | sjur.brandeland@stericsson.com <sjur.brandeland@stericsson.com> | 2011-05-12 22:44:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-15 17:45:56 -0400 |
commit | c85c2951d4da1236e32f1858db418221e624aba5 (patch) | |
tree | 8f70d7ab3dbe05ea6f812f9bfb8d341425a29193 /net/caif/caif_socket.c | |
parent | bee925db9a77a5736596dcf6f91d0879f5ee915b (diff) |
caif: Handle dev_queue_xmit errors.
Do proper handling of dev_queue_xmit errors in order to
avoid double free of skb and leaks in error conditions.
In cfctrl pending requests are removed when CAIF Link layer goes down.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif/caif_socket.c')
-rw-r--r-- | net/caif/caif_socket.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index 653db759eb7e..7baae11a6126 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
@@ -604,7 +604,9 @@ static int caif_seqpkt_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
604 | goto err; | 604 | goto err; |
605 | ret = transmit_skb(skb, cf_sk, noblock, timeo); | 605 | ret = transmit_skb(skb, cf_sk, noblock, timeo); |
606 | if (ret < 0) | 606 | if (ret < 0) |
607 | goto err; | 607 | /* skb is already freed */ |
608 | return ret; | ||
609 | |||
608 | return len; | 610 | return len; |
609 | err: | 611 | err: |
610 | kfree_skb(skb); | 612 | kfree_skb(skb); |
@@ -933,9 +935,9 @@ static int caif_release(struct socket *sock) | |||
933 | * caif_queue_rcv_skb checks SOCK_DEAD holding the queue lock, | 935 | * caif_queue_rcv_skb checks SOCK_DEAD holding the queue lock, |
934 | * this ensures no packets when sock is dead. | 936 | * this ensures no packets when sock is dead. |
935 | */ | 937 | */ |
936 | spin_lock(&sk->sk_receive_queue.lock); | 938 | spin_lock_bh(&sk->sk_receive_queue.lock); |
937 | sock_set_flag(sk, SOCK_DEAD); | 939 | sock_set_flag(sk, SOCK_DEAD); |
938 | spin_unlock(&sk->sk_receive_queue.lock); | 940 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
939 | sock->sk = NULL; | 941 | sock->sk = NULL; |
940 | 942 | ||
941 | dbfs_atomic_inc(&cnt.num_disconnect); | 943 | dbfs_atomic_inc(&cnt.num_disconnect); |