aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-09-20 15:42:47 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-09-20 15:42:47 -0400
commitf685ddaf0fc9b9f53eb9346c858664776becf5d9 (patch)
treeb28883e47171c16e69178e2b9ccaad9985778a9e /net
parent460edb3cd06865ffb231eb694b567daec3113210 (diff)
parentcd46171c7297739dc7e46d885862e98023eab9c7 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [BNX2]: Add PHY workaround for 5709 A1. [PPP] L2TP: Fix skb handling in pppol2tp_xmit [PPP] L2TP: Fix skb handling in pppol2tp_recv_core [PPP] L2TP: Disallow non-UDP datagram sockets [PPP] pppoe: Fix double-free on skb after transmit failure [PKT_SCHED]: Fix 'SFQ qdisc crashes with limit of 2 packets' [NETFILTER]: MAINTAINERS update [NETFILTER]: nfnetlink_log: fix sending of multipart messages
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nfnetlink_log.c13
-rw-r--r--net/sched/sch_sfq.c10
2 files changed, 12 insertions, 11 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index e185a5b55913..2351533a8507 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -58,7 +58,6 @@ struct nfulnl_instance {
58 58
59 unsigned int qlen; /* number of nlmsgs in skb */ 59 unsigned int qlen; /* number of nlmsgs in skb */
60 struct sk_buff *skb; /* pre-allocatd skb */ 60 struct sk_buff *skb; /* pre-allocatd skb */
61 struct nlmsghdr *lastnlh; /* netlink header of last msg in skb */
62 struct timer_list timer; 61 struct timer_list timer;
63 int peer_pid; /* PID of the peer process */ 62 int peer_pid; /* PID of the peer process */
64 63
@@ -345,10 +344,12 @@ static struct sk_buff *nfulnl_alloc_skb(unsigned int inst_size,
345static int 344static int
346__nfulnl_send(struct nfulnl_instance *inst) 345__nfulnl_send(struct nfulnl_instance *inst)
347{ 346{
348 int status; 347 int status = -1;
349 348
350 if (inst->qlen > 1) 349 if (inst->qlen > 1)
351 inst->lastnlh->nlmsg_type = NLMSG_DONE; 350 NLMSG_PUT(inst->skb, 0, 0,
351 NLMSG_DONE,
352 sizeof(struct nfgenmsg));
352 353
353 status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT); 354 status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT);
354 if (status < 0) { 355 if (status < 0) {
@@ -358,8 +359,8 @@ __nfulnl_send(struct nfulnl_instance *inst)
358 359
359 inst->qlen = 0; 360 inst->qlen = 0;
360 inst->skb = NULL; 361 inst->skb = NULL;
361 inst->lastnlh = NULL;
362 362
363nlmsg_failure:
363 return status; 364 return status;
364} 365}
365 366
@@ -538,7 +539,6 @@ __build_packet_message(struct nfulnl_instance *inst,
538 } 539 }
539 540
540 nlh->nlmsg_len = inst->skb->tail - old_tail; 541 nlh->nlmsg_len = inst->skb->tail - old_tail;
541 inst->lastnlh = nlh;
542 return 0; 542 return 0;
543 543
544nlmsg_failure: 544nlmsg_failure:
@@ -644,7 +644,8 @@ nfulnl_log_packet(unsigned int pf,
644 } 644 }
645 645
646 if (inst->qlen >= qthreshold || 646 if (inst->qlen >= qthreshold ||
647 (inst->skb && size > skb_tailroom(inst->skb))) { 647 (inst->skb && size >
648 skb_tailroom(inst->skb) - sizeof(struct nfgenmsg))) {
648 /* either the queue len is too high or we don't have 649 /* either the queue len is too high or we don't have
649 * enough room in the skb left. flush to userspace. */ 650 * enough room in the skb left. flush to userspace. */
650 UDEBUG("flushing old skb\n"); 651 UDEBUG("flushing old skb\n");
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 957957309859..3a23e30bc79e 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -270,7 +270,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
270 q->tail = x; 270 q->tail = x;
271 } 271 }
272 } 272 }
273 if (++sch->q.qlen < q->limit-1) { 273 if (++sch->q.qlen <= q->limit) {
274 sch->bstats.bytes += skb->len; 274 sch->bstats.bytes += skb->len;
275 sch->bstats.packets++; 275 sch->bstats.packets++;
276 return 0; 276 return 0;
@@ -306,7 +306,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
306 q->tail = x; 306 q->tail = x;
307 } 307 }
308 } 308 }
309 if (++sch->q.qlen < q->limit - 1) { 309 if (++sch->q.qlen <= q->limit) {
310 sch->qstats.requeues++; 310 sch->qstats.requeues++;
311 return 0; 311 return 0;
312 } 312 }
@@ -391,10 +391,10 @@ static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
391 q->quantum = ctl->quantum ? : psched_mtu(sch->dev); 391 q->quantum = ctl->quantum ? : psched_mtu(sch->dev);
392 q->perturb_period = ctl->perturb_period*HZ; 392 q->perturb_period = ctl->perturb_period*HZ;
393 if (ctl->limit) 393 if (ctl->limit)
394 q->limit = min_t(u32, ctl->limit, SFQ_DEPTH); 394 q->limit = min_t(u32, ctl->limit, SFQ_DEPTH - 2);
395 395
396 qlen = sch->q.qlen; 396 qlen = sch->q.qlen;
397 while (sch->q.qlen >= q->limit-1) 397 while (sch->q.qlen > q->limit)
398 sfq_drop(sch); 398 sfq_drop(sch);
399 qdisc_tree_decrease_qlen(sch, qlen - sch->q.qlen); 399 qdisc_tree_decrease_qlen(sch, qlen - sch->q.qlen);
400 400
@@ -423,7 +423,7 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
423 q->dep[i+SFQ_DEPTH].next = i+SFQ_DEPTH; 423 q->dep[i+SFQ_DEPTH].next = i+SFQ_DEPTH;
424 q->dep[i+SFQ_DEPTH].prev = i+SFQ_DEPTH; 424 q->dep[i+SFQ_DEPTH].prev = i+SFQ_DEPTH;
425 } 425 }
426 q->limit = SFQ_DEPTH; 426 q->limit = SFQ_DEPTH - 2;
427 q->max_depth = 0; 427 q->max_depth = 0;
428 q->tail = SFQ_DEPTH; 428 q->tail = SFQ_DEPTH;
429 if (opt == NULL) { 429 if (opt == NULL) {