On Thu, 2005-04-07 at 15:47 -0700, Jay Lan wrote: > BTW, when it happened last time, my program listening to the socket > complained about duplicate messages received. > > Unmatched seq. Rcvd=1824062, expected=1824061 <=== > Unmatched seq. Rcvd=1824062, expected=1824063 <=== > Unmatched seq. Rcvd=1824348, expected=1824307 > > When my program received 1824062 while expecting 1824061 > it adjusted itself to expect the next one being 1824063. But instead > the message of 1824062 arrived the second time.
Thank you for your report. Could you reproduce a bug with the attached patch? > - jay * looking for [EMAIL PROTECTED]/connector--main--0--patch-38 to compare with * comparing to [EMAIL PROTECTED]/connector--main--0--patch-38 M connector.c * modified files --- orig/drivers/connector/connector.c +++ mod/drivers/connector/connector.c @@ -121,7 +121,7 @@ NETLINK_CB(skb).dst_groups = groups; uskb = skb_clone(skb, GFP_ATOMIC); - if (uskb) + if (uskb && 0) netlink_unicast(dev->nls, uskb, 0, 0); netlink_broadcast(dev->nls, skb, 0, groups, GFP_ATOMIC); @@ -158,7 +158,7 @@ } spin_unlock_bh(&dev->cbdev->queue_lock); - return found; + return (found)?0:-ENODEV; } /* @@ -181,7 +181,6 @@ "requested msg->len=%u[%u], nlh->nlmsg_len=%u, skb->len=%u.\n", msg->len, NLMSG_SPACE(msg->len + sizeof(*msg)), nlh->nlmsg_len, skb->len); - kfree_skb(skb); return -EINVAL; } #if 0 @@ -215,17 +214,18 @@ skb->len, skb->data_len, skb->truesize, skb->protocol, skb_cloned(skb), skb_shared(skb)); #endif - while (skb->len >= NLMSG_SPACE(0)) { + if (skb->len >= NLMSG_SPACE(0)) { nlh = (struct nlmsghdr *)skb->data; + if (nlh->nlmsg_len < sizeof(struct cn_msg) || skb->len < nlh->nlmsg_len || nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) { -#if 0 +#if 1 printk(KERN_INFO "nlmsg_len=%u, sizeof(*nlh)=%u\n", nlh->nlmsg_len, sizeof(*nlh)); #endif kfree_skb(skb); - break; + goto out; } len = NLMSG_ALIGN(nlh->nlmsg_len); @@ -233,22 +233,11 @@ len = skb->len; err = __cn_rx_skb(skb, nlh); - if (err) { -#if 0 - if (err < 0 && (nlh->nlmsg_flags & NLM_F_ACK)) - netlink_ack(skb, nlh, -err); -#endif - break; - } else { -#if 0 - if (nlh->nlmsg_flags & NLM_F_ACK) - netlink_ack(skb, nlh, 0); -#endif - break; - } - skb_pull(skb, len); + if (err < 0) + kfree_skb(skb); } - + +out: kfree_skb(__skb); } -- Evgeniy Polyakov Crash is better than data corruption -- Arthur Grabowski
signature.asc
Description: This is a digitally signed message part