diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2009-10-01 22:40:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-02 13:53:58 -0400 |
commit | 293500a23f4b0698cb04abfecfc9a954d8ab2742 (patch) | |
tree | 15c873cfbdaebe5f644ae60958c656fd449061d5 /drivers/connector/connector.c | |
parent | 19d5afd4f0d26201d8d8bec351ee0442775a5379 (diff) |
connector: Keep the skb in cn_callback_data
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Acked-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/connector/connector.c')
-rw-r--r-- | drivers/connector/connector.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 74f52af79563..fc9887fa453f 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -129,10 +129,11 @@ EXPORT_SYMBOL_GPL(cn_netlink_send); | |||
129 | /* | 129 | /* |
130 | * Callback helper - queues work and setup destructor for given data. | 130 | * Callback helper - queues work and setup destructor for given data. |
131 | */ | 131 | */ |
132 | static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data) | 132 | static int cn_call_callback(struct sk_buff *skb, void (*destruct_data)(void *), void *data) |
133 | { | 133 | { |
134 | struct cn_callback_entry *__cbq, *__new_cbq; | 134 | struct cn_callback_entry *__cbq, *__new_cbq; |
135 | struct cn_dev *dev = &cdev; | 135 | struct cn_dev *dev = &cdev; |
136 | struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb)); | ||
136 | int err = -ENODEV; | 137 | int err = -ENODEV; |
137 | 138 | ||
138 | spin_lock_bh(&dev->cbdev->queue_lock); | 139 | spin_lock_bh(&dev->cbdev->queue_lock); |
@@ -140,7 +141,7 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
140 | if (cn_cb_equal(&__cbq->id.id, &msg->id)) { | 141 | if (cn_cb_equal(&__cbq->id.id, &msg->id)) { |
141 | if (likely(!work_pending(&__cbq->work) && | 142 | if (likely(!work_pending(&__cbq->work) && |
142 | __cbq->data.ddata == NULL)) { | 143 | __cbq->data.ddata == NULL)) { |
143 | __cbq->data.callback_priv = msg; | 144 | __cbq->data.skb = skb; |
144 | 145 | ||
145 | __cbq->data.ddata = data; | 146 | __cbq->data.ddata = data; |
146 | __cbq->data.destruct_data = destruct_data; | 147 | __cbq->data.destruct_data = destruct_data; |
@@ -156,7 +157,7 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
156 | __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); | 157 | __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); |
157 | if (__new_cbq) { | 158 | if (__new_cbq) { |
158 | d = &__new_cbq->data; | 159 | d = &__new_cbq->data; |
159 | d->callback_priv = msg; | 160 | d->skb = skb; |
160 | d->callback = __cbq->data.callback; | 161 | d->callback = __cbq->data.callback; |
161 | d->ddata = data; | 162 | d->ddata = data; |
162 | d->destruct_data = destruct_data; | 163 | d->destruct_data = destruct_data; |
@@ -191,7 +192,6 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
191 | */ | 192 | */ |
192 | static void cn_rx_skb(struct sk_buff *__skb) | 193 | static void cn_rx_skb(struct sk_buff *__skb) |
193 | { | 194 | { |
194 | struct cn_msg *msg; | ||
195 | struct nlmsghdr *nlh; | 195 | struct nlmsghdr *nlh; |
196 | int err; | 196 | int err; |
197 | struct sk_buff *skb; | 197 | struct sk_buff *skb; |
@@ -208,8 +208,7 @@ static void cn_rx_skb(struct sk_buff *__skb) | |||
208 | return; | 208 | return; |
209 | } | 209 | } |
210 | 210 | ||
211 | msg = NLMSG_DATA(nlh); | 211 | err = cn_call_callback(skb, (void (*)(void *))kfree_skb, skb); |
212 | err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb); | ||
213 | if (err < 0) | 212 | if (err < 0) |
214 | kfree_skb(skb); | 213 | kfree_skb(skb); |
215 | } | 214 | } |