X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fconnector%2Fconnector.c;h=37976dcf044b0ea96b2f6e731e4221a9d0a8e664;hb=bb5cf80e94ad9650c4bd39e92fb917af8e87fa43;hp=0e328d387af4cbecdb326238b12d904dfe4988b1;hpb=dcf397f037f52add9945eced57ca300ab6a4413c;p=linux-2.6-omap-h63xx.git diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 0e328d387af..37976dcf044 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c @@ -88,6 +88,7 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask) if (cn_cb_equal(&__cbq->id.id, &msg->id)) { found = 1; group = __cbq->group; + break; } } spin_unlock_bh(&dev->cbdev->queue_lock); @@ -145,6 +146,8 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v if (queue_work(dev->cbdev->cn_queue, &__cbq->work)) err = 0; + else + err = -EINVAL; } else { struct cn_callback_data *d; @@ -178,34 +181,15 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v return err; } -/* - * Skb receive helper - checks skb and msg size and calls callback - * helper. - */ -static int __cn_rx_skb(struct sk_buff *skb, struct nlmsghdr *nlh) -{ - u32 pid, uid, seq, group; - struct cn_msg *msg; - - pid = NETLINK_CREDS(skb)->pid; - uid = NETLINK_CREDS(skb)->uid; - seq = nlh->nlmsg_seq; - group = NETLINK_CB((skb)).dst_group; - msg = NLMSG_DATA(nlh); - - return cn_call_callback(msg, (void (*)(void *))kfree_skb, skb); -} - /* * Main netlink receiving function. * - * It checks skb and netlink header sizes and calls the skb receive - * helper with a shared skb. + * It checks skb, netlink header and msg sizes, and calls callback helper. */ static void cn_rx_skb(struct sk_buff *__skb) { + struct cn_msg *msg; struct nlmsghdr *nlh; - u32 len; int err; struct sk_buff *skb; @@ -218,20 +202,14 @@ static void cn_rx_skb(struct sk_buff *__skb) skb->len < nlh->nlmsg_len || nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) { kfree_skb(skb); - goto out; + return; } - len = NLMSG_ALIGN(nlh->nlmsg_len); - if (len > skb->len) - len = skb->len; - - err = __cn_rx_skb(skb, nlh); + msg = NLMSG_DATA(nlh); + err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb); if (err < 0) kfree_skb(skb); } - -out: - kfree_skb(__skb); } /*