aboutsummaryrefslogtreecommitdiffstats
path: root/net/iucv/af_iucv.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/iucv/af_iucv.c')
-rw-r--r--net/iucv/af_iucv.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 2255e3c082ed..fee22caf1bad 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -482,6 +482,10 @@ static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
482 /* Create path. */ 482 /* Create path. */
483 iucv->path = iucv_path_alloc(IUCV_QUEUELEN_DEFAULT, 483 iucv->path = iucv_path_alloc(IUCV_QUEUELEN_DEFAULT,
484 IPRMDATA, GFP_KERNEL); 484 IPRMDATA, GFP_KERNEL);
485 if (!iucv->path) {
486 err = -ENOMEM;
487 goto done;
488 }
485 err = iucv_path_connect(iucv->path, &af_iucv_handler, 489 err = iucv_path_connect(iucv->path, &af_iucv_handler,
486 sa->siucv_user_id, NULL, user_data, sk); 490 sa->siucv_user_id, NULL, user_data, sk);
487 if (err) { 491 if (err) {
@@ -1094,6 +1098,8 @@ static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg)
1094 1098
1095save_message: 1099save_message:
1096 save_msg = kzalloc(sizeof(struct sock_msg_q), GFP_ATOMIC | GFP_DMA); 1100 save_msg = kzalloc(sizeof(struct sock_msg_q), GFP_ATOMIC | GFP_DMA);
1101 if (!save_msg)
1102 return;
1097 save_msg->path = path; 1103 save_msg->path = path;
1098 save_msg->msg = *msg; 1104 save_msg->msg = *msg;
1099 1105
@@ -1106,24 +1112,31 @@ static void iucv_callback_txdone(struct iucv_path *path,
1106 struct iucv_message *msg) 1112 struct iucv_message *msg)
1107{ 1113{
1108 struct sock *sk = path->private; 1114 struct sock *sk = path->private;
1109 struct sk_buff *this; 1115 struct sk_buff *this = NULL;
1110 struct sk_buff_head *list = &iucv_sk(sk)->send_skb_q; 1116 struct sk_buff_head *list = &iucv_sk(sk)->send_skb_q;
1111 struct sk_buff *list_skb = list->next; 1117 struct sk_buff *list_skb = list->next;
1112 unsigned long flags; 1118 unsigned long flags;
1113 1119
1114 if (list_skb) { 1120 if (!skb_queue_empty(list)) {
1115 spin_lock_irqsave(&list->lock, flags); 1121 spin_lock_irqsave(&list->lock, flags);
1116 1122
1117 do { 1123 while (list_skb != (struct sk_buff *)list) {
1118 this = list_skb; 1124 if (!memcmp(&msg->tag, list_skb->cb, 4)) {
1125 this = list_skb;
1126 break;
1127 }
1119 list_skb = list_skb->next; 1128 list_skb = list_skb->next;
1120 } while (memcmp(&msg->tag, this->cb, 4) && list_skb); 1129 }
1130 if (this)
1131 __skb_unlink(this, list);
1121 1132
1122 spin_unlock_irqrestore(&list->lock, flags); 1133 spin_unlock_irqrestore(&list->lock, flags);
1123 1134
1124 skb_unlink(this, &iucv_sk(sk)->send_skb_q); 1135 if (this)
1125 kfree_skb(this); 1136 kfree_skb(this);
1126 } 1137 }
1138 if (!this)
1139 printk(KERN_ERR "AF_IUCV msg tag %u not found\n", msg->tag);
1127 1140
1128 if (sk->sk_state == IUCV_CLOSING) { 1141 if (sk->sk_state == IUCV_CLOSING) {
1129 if (skb_queue_empty(&iucv_sk(sk)->send_skb_q)) { 1142 if (skb_queue_empty(&iucv_sk(sk)->send_skb_q)) {