diff options
Diffstat (limited to 'drivers/connector')
-rw-r--r-- | drivers/connector/connector.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index edf1349c4e1f..37976dcf044b 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -182,33 +182,14 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
182 | } | 182 | } |
183 | 183 | ||
184 | /* | 184 | /* |
185 | * Skb receive helper - checks skb and msg size and calls callback | ||
186 | * helper. | ||
187 | */ | ||
188 | static int __cn_rx_skb(struct sk_buff *skb, struct nlmsghdr *nlh) | ||
189 | { | ||
190 | u32 pid, uid, seq, group; | ||
191 | struct cn_msg *msg; | ||
192 | |||
193 | pid = NETLINK_CREDS(skb)->pid; | ||
194 | uid = NETLINK_CREDS(skb)->uid; | ||
195 | seq = nlh->nlmsg_seq; | ||
196 | group = NETLINK_CB((skb)).dst_group; | ||
197 | msg = NLMSG_DATA(nlh); | ||
198 | |||
199 | return cn_call_callback(msg, (void (*)(void *))kfree_skb, skb); | ||
200 | } | ||
201 | |||
202 | /* | ||
203 | * Main netlink receiving function. | 185 | * Main netlink receiving function. |
204 | * | 186 | * |
205 | * It checks skb and netlink header sizes and calls the skb receive | 187 | * It checks skb, netlink header and msg sizes, and calls callback helper. |
206 | * helper with a shared skb. | ||
207 | */ | 188 | */ |
208 | static void cn_rx_skb(struct sk_buff *__skb) | 189 | static void cn_rx_skb(struct sk_buff *__skb) |
209 | { | 190 | { |
191 | struct cn_msg *msg; | ||
210 | struct nlmsghdr *nlh; | 192 | struct nlmsghdr *nlh; |
211 | u32 len; | ||
212 | int err; | 193 | int err; |
213 | struct sk_buff *skb; | 194 | struct sk_buff *skb; |
214 | 195 | ||
@@ -224,11 +205,8 @@ static void cn_rx_skb(struct sk_buff *__skb) | |||
224 | return; | 205 | return; |
225 | } | 206 | } |
226 | 207 | ||
227 | len = NLMSG_ALIGN(nlh->nlmsg_len); | 208 | msg = NLMSG_DATA(nlh); |
228 | if (len > skb->len) | 209 | err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb); |
229 | len = skb->len; | ||
230 | |||
231 | err = __cn_rx_skb(skb, nlh); | ||
232 | if (err < 0) | 210 | if (err < 0) |
233 | kfree_skb(skb); | 211 | kfree_skb(skb); |
234 | } | 212 | } |