diff options
Diffstat (limited to 'net/netlink/af_netlink.c')
-rw-r--r-- | net/netlink/af_netlink.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 5d1079b1838c..1823b7c63156 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1463,7 +1463,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) | |||
1463 | } | 1463 | } |
1464 | 1464 | ||
1465 | static int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *, | 1465 | static int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *, |
1466 | struct nlmsghdr *, int *)) | 1466 | struct nlmsghdr *)) |
1467 | { | 1467 | { |
1468 | struct nlmsghdr *nlh; | 1468 | struct nlmsghdr *nlh; |
1469 | int err; | 1469 | int err; |
@@ -1483,13 +1483,11 @@ static int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *, | |||
1483 | if (nlh->nlmsg_type < NLMSG_MIN_TYPE) | 1483 | if (nlh->nlmsg_type < NLMSG_MIN_TYPE) |
1484 | goto skip; | 1484 | goto skip; |
1485 | 1485 | ||
1486 | if (cb(skb, nlh, &err) < 0) { | 1486 | err = cb(skb, nlh); |
1487 | /* Not an error, but we have to interrupt processing | 1487 | if (err == -EINTR) { |
1488 | * here. Note: that in this case we do not pull | 1488 | /* Not an error, but we interrupt processing */ |
1489 | * message from skb, it will be processed later. | 1489 | netlink_queue_skip(nlh, skb); |
1490 | */ | 1490 | return err; |
1491 | if (err == 0) | ||
1492 | return -1; | ||
1493 | } | 1491 | } |
1494 | skip: | 1492 | skip: |
1495 | if (nlh->nlmsg_flags & NLM_F_ACK || err) | 1493 | if (nlh->nlmsg_flags & NLM_F_ACK || err) |
@@ -1515,9 +1513,14 @@ skip: | |||
1515 | * | 1513 | * |
1516 | * qlen must be initialized to 0 before the initial entry, afterwards | 1514 | * qlen must be initialized to 0 before the initial entry, afterwards |
1517 | * the function may be called repeatedly until qlen reaches 0. | 1515 | * the function may be called repeatedly until qlen reaches 0. |
1516 | * | ||
1517 | * The callback function may return -EINTR to signal that processing | ||
1518 | * of netlink messages shall be interrupted. In this case the message | ||
1519 | * currently being processed will NOT be requeued onto the receive | ||
1520 | * queue. | ||
1518 | */ | 1521 | */ |
1519 | void netlink_run_queue(struct sock *sk, unsigned int *qlen, | 1522 | void netlink_run_queue(struct sock *sk, unsigned int *qlen, |
1520 | int (*cb)(struct sk_buff *, struct nlmsghdr *, int *)) | 1523 | int (*cb)(struct sk_buff *, struct nlmsghdr *)) |
1521 | { | 1524 | { |
1522 | struct sk_buff *skb; | 1525 | struct sk_buff *skb; |
1523 | 1526 | ||