diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-09-22 06:57:21 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-09-22 06:57:21 -0400 |
commit | d389424e00f9097cd24b3df4ca0ab7221f140eeb (patch) | |
tree | 9ffa95a4e791b19e5d793a06943e40221858b236 /net/llc/llc_c_ac.c | |
parent | 2928c19e1086e2f1e90d05931437ab6f1e4cfdc8 (diff) |
[LLC]: Fix the accept path
Borrowing the structure of TCP/IP for this. On the receive of new connections I
was bh_lock_socking the _new_ sock, not the listening one, duh, now it survives
the ssh connections storm I've been using to test this specific bug.
Also fixes send side skb sock accounting.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/llc/llc_c_ac.c')
-rw-r--r-- | net/llc/llc_c_ac.c | 64 |
1 files changed, 25 insertions, 39 deletions
diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c index 8f7b46d20638..b0bcfb1f12dd 100644 --- a/net/llc/llc_c_ac.c +++ b/net/llc/llc_c_ac.c | |||
@@ -60,24 +60,10 @@ int llc_conn_ac_clear_remote_busy(struct sock *sk, struct sk_buff *skb) | |||
60 | 60 | ||
61 | int llc_conn_ac_conn_ind(struct sock *sk, struct sk_buff *skb) | 61 | int llc_conn_ac_conn_ind(struct sock *sk, struct sk_buff *skb) |
62 | { | 62 | { |
63 | int rc = -ENOTCONN; | 63 | struct llc_conn_state_ev *ev = llc_conn_ev(skb); |
64 | u8 dsap; | ||
65 | struct llc_sap *sap; | ||
66 | |||
67 | llc_pdu_decode_dsap(skb, &dsap); | ||
68 | sap = llc_sap_find(dsap); | ||
69 | if (sap) { | ||
70 | struct llc_conn_state_ev *ev = llc_conn_ev(skb); | ||
71 | struct llc_sock *llc = llc_sk(sk); | ||
72 | 64 | ||
73 | llc_pdu_decode_sa(skb, llc->daddr.mac); | 65 | ev->ind_prim = LLC_CONN_PRIM; |
74 | llc_pdu_decode_da(skb, llc->laddr.mac); | 66 | return 0; |
75 | llc->dev = skb->dev; | ||
76 | ev->ind_prim = LLC_CONN_PRIM; | ||
77 | rc = 0; | ||
78 | llc_sap_put(sap); | ||
79 | } | ||
80 | return rc; | ||
81 | } | 67 | } |
82 | 68 | ||
83 | int llc_conn_ac_conn_confirm(struct sock *sk, struct sk_buff *skb) | 69 | int llc_conn_ac_conn_confirm(struct sock *sk, struct sk_buff *skb) |
@@ -213,7 +199,7 @@ int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) | |||
213 | { | 199 | { |
214 | int rc = -ENOBUFS; | 200 | int rc = -ENOBUFS; |
215 | struct llc_sock *llc = llc_sk(sk); | 201 | struct llc_sock *llc = llc_sk(sk); |
216 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 202 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
217 | 203 | ||
218 | if (nskb) { | 204 | if (nskb) { |
219 | struct llc_sap *sap = llc->sap; | 205 | struct llc_sap *sap = llc->sap; |
@@ -238,7 +224,7 @@ int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) | |||
238 | { | 224 | { |
239 | int rc = -ENOBUFS; | 225 | int rc = -ENOBUFS; |
240 | struct llc_sock *llc = llc_sk(sk); | 226 | struct llc_sock *llc = llc_sk(sk); |
241 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 227 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
242 | 228 | ||
243 | if (nskb) { | 229 | if (nskb) { |
244 | struct llc_sap *sap = llc->sap; | 230 | struct llc_sap *sap = llc->sap; |
@@ -264,7 +250,7 @@ int llc_conn_ac_send_dm_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) | |||
264 | { | 250 | { |
265 | int rc = -ENOBUFS; | 251 | int rc = -ENOBUFS; |
266 | struct llc_sock *llc = llc_sk(sk); | 252 | struct llc_sock *llc = llc_sk(sk); |
267 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 253 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
268 | 254 | ||
269 | if (nskb) { | 255 | if (nskb) { |
270 | struct llc_sap *sap = llc->sap; | 256 | struct llc_sap *sap = llc->sap; |
@@ -297,7 +283,7 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, struct sk_buff *skb) | |||
297 | llc_pdu_decode_pf_bit(skb, &f_bit); | 283 | llc_pdu_decode_pf_bit(skb, &f_bit); |
298 | else | 284 | else |
299 | f_bit = 0; | 285 | f_bit = 0; |
300 | nskb = llc_alloc_frame(llc->dev); | 286 | nskb = llc_alloc_frame(sk, llc->dev); |
301 | if (nskb) { | 287 | if (nskb) { |
302 | struct llc_sap *sap = llc->sap; | 288 | struct llc_sap *sap = llc->sap; |
303 | 289 | ||
@@ -321,7 +307,7 @@ int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk, struct sk_buff *skb) | |||
321 | { | 307 | { |
322 | int rc = -ENOBUFS; | 308 | int rc = -ENOBUFS; |
323 | struct llc_sock *llc = llc_sk(sk); | 309 | struct llc_sock *llc = llc_sk(sk); |
324 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 310 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
325 | 311 | ||
326 | if (nskb) { | 312 | if (nskb) { |
327 | struct llc_sap *sap = llc->sap; | 313 | struct llc_sap *sap = llc->sap; |
@@ -351,7 +337,7 @@ int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) | |||
351 | struct llc_sock *llc = llc_sk(sk); | 337 | struct llc_sock *llc = llc_sk(sk); |
352 | 338 | ||
353 | llc_pdu_decode_pf_bit(skb, &f_bit); | 339 | llc_pdu_decode_pf_bit(skb, &f_bit); |
354 | nskb = llc_alloc_frame(llc->dev); | 340 | nskb = llc_alloc_frame(sk, llc->dev); |
355 | if (nskb) { | 341 | if (nskb) { |
356 | struct llc_sap *sap = llc->sap; | 342 | struct llc_sap *sap = llc->sap; |
357 | struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); | 343 | struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); |
@@ -439,7 +425,7 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk, | |||
439 | struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); | 425 | struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); |
440 | int rc = -ENOBUFS; | 426 | int rc = -ENOBUFS; |
441 | struct llc_sock *llc = llc_sk(sk); | 427 | struct llc_sock *llc = llc_sk(sk); |
442 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 428 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
443 | 429 | ||
444 | if (nskb) { | 430 | if (nskb) { |
445 | struct llc_sap *sap = llc->sap; | 431 | struct llc_sap *sap = llc->sap; |
@@ -474,7 +460,7 @@ int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) | |||
474 | { | 460 | { |
475 | int rc = -ENOBUFS; | 461 | int rc = -ENOBUFS; |
476 | struct llc_sock *llc = llc_sk(sk); | 462 | struct llc_sock *llc = llc_sk(sk); |
477 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 463 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
478 | 464 | ||
479 | if (nskb) { | 465 | if (nskb) { |
480 | struct llc_sap *sap = llc->sap; | 466 | struct llc_sap *sap = llc->sap; |
@@ -498,7 +484,7 @@ int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) | |||
498 | { | 484 | { |
499 | int rc = -ENOBUFS; | 485 | int rc = -ENOBUFS; |
500 | struct llc_sock *llc = llc_sk(sk); | 486 | struct llc_sock *llc = llc_sk(sk); |
501 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 487 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
502 | 488 | ||
503 | if (nskb) { | 489 | if (nskb) { |
504 | struct llc_sap *sap = llc->sap; | 490 | struct llc_sap *sap = llc->sap; |
@@ -522,7 +508,7 @@ int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) | |||
522 | { | 508 | { |
523 | int rc = -ENOBUFS; | 509 | int rc = -ENOBUFS; |
524 | struct llc_sock *llc = llc_sk(sk); | 510 | struct llc_sock *llc = llc_sk(sk); |
525 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 511 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
526 | 512 | ||
527 | if (nskb) { | 513 | if (nskb) { |
528 | struct llc_sap *sap = llc->sap; | 514 | struct llc_sap *sap = llc->sap; |
@@ -546,7 +532,7 @@ int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) | |||
546 | { | 532 | { |
547 | int rc = -ENOBUFS; | 533 | int rc = -ENOBUFS; |
548 | struct llc_sock *llc = llc_sk(sk); | 534 | struct llc_sock *llc = llc_sk(sk); |
549 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 535 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
550 | 536 | ||
551 | if (nskb) { | 537 | if (nskb) { |
552 | struct llc_sap *sap = llc->sap; | 538 | struct llc_sap *sap = llc->sap; |
@@ -570,7 +556,7 @@ int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) | |||
570 | { | 556 | { |
571 | int rc = -ENOBUFS; | 557 | int rc = -ENOBUFS; |
572 | struct llc_sock *llc = llc_sk(sk); | 558 | struct llc_sock *llc = llc_sk(sk); |
573 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 559 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
574 | 560 | ||
575 | if (nskb) { | 561 | if (nskb) { |
576 | struct llc_sap *sap = llc->sap; | 562 | struct llc_sap *sap = llc->sap; |
@@ -594,7 +580,7 @@ int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) | |||
594 | { | 580 | { |
595 | int rc = -ENOBUFS; | 581 | int rc = -ENOBUFS; |
596 | struct llc_sock *llc = llc_sk(sk); | 582 | struct llc_sock *llc = llc_sk(sk); |
597 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 583 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
598 | 584 | ||
599 | if (nskb) { | 585 | if (nskb) { |
600 | struct llc_sap *sap = llc->sap; | 586 | struct llc_sap *sap = llc->sap; |
@@ -630,7 +616,7 @@ int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) | |||
630 | { | 616 | { |
631 | int rc = -ENOBUFS; | 617 | int rc = -ENOBUFS; |
632 | struct llc_sock *llc = llc_sk(sk); | 618 | struct llc_sock *llc = llc_sk(sk); |
633 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 619 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
634 | 620 | ||
635 | if (nskb) { | 621 | if (nskb) { |
636 | struct llc_sap *sap = llc->sap; | 622 | struct llc_sap *sap = llc->sap; |
@@ -654,7 +640,7 @@ int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) | |||
654 | { | 640 | { |
655 | int rc = -ENOBUFS; | 641 | int rc = -ENOBUFS; |
656 | struct llc_sock *llc = llc_sk(sk); | 642 | struct llc_sock *llc = llc_sk(sk); |
657 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 643 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
658 | 644 | ||
659 | if (nskb) { | 645 | if (nskb) { |
660 | struct llc_sap *sap = llc->sap; | 646 | struct llc_sap *sap = llc->sap; |
@@ -678,7 +664,7 @@ int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) | |||
678 | { | 664 | { |
679 | int rc = -ENOBUFS; | 665 | int rc = -ENOBUFS; |
680 | struct llc_sock *llc = llc_sk(sk); | 666 | struct llc_sock *llc = llc_sk(sk); |
681 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 667 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
682 | 668 | ||
683 | if (nskb) { | 669 | if (nskb) { |
684 | struct llc_sap *sap = llc->sap; | 670 | struct llc_sap *sap = llc->sap; |
@@ -703,7 +689,7 @@ int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) | |||
703 | { | 689 | { |
704 | int rc = -ENOBUFS; | 690 | int rc = -ENOBUFS; |
705 | struct llc_sock *llc = llc_sk(sk); | 691 | struct llc_sock *llc = llc_sk(sk); |
706 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 692 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
707 | 693 | ||
708 | if (nskb) { | 694 | if (nskb) { |
709 | struct llc_sap *sap = llc->sap; | 695 | struct llc_sap *sap = llc->sap; |
@@ -727,7 +713,7 @@ int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) | |||
727 | { | 713 | { |
728 | int rc = -ENOBUFS; | 714 | int rc = -ENOBUFS; |
729 | struct llc_sock *llc = llc_sk(sk); | 715 | struct llc_sock *llc = llc_sk(sk); |
730 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 716 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
731 | 717 | ||
732 | if (nskb) { | 718 | if (nskb) { |
733 | struct llc_sap *sap = llc->sap; | 719 | struct llc_sap *sap = llc->sap; |
@@ -751,7 +737,7 @@ int llc_conn_ac_send_ack_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) | |||
751 | { | 737 | { |
752 | int rc = -ENOBUFS; | 738 | int rc = -ENOBUFS; |
753 | struct llc_sock *llc = llc_sk(sk); | 739 | struct llc_sock *llc = llc_sk(sk); |
754 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 740 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
755 | 741 | ||
756 | if (nskb) { | 742 | if (nskb) { |
757 | struct llc_sap *sap = llc->sap; | 743 | struct llc_sap *sap = llc->sap; |
@@ -785,7 +771,7 @@ int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) | |||
785 | { | 771 | { |
786 | int rc = -ENOBUFS; | 772 | int rc = -ENOBUFS; |
787 | struct llc_sock *llc = llc_sk(sk); | 773 | struct llc_sock *llc = llc_sk(sk); |
788 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 774 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
789 | 775 | ||
790 | if (nskb) { | 776 | if (nskb) { |
791 | struct llc_sap *sap = llc->sap; | 777 | struct llc_sap *sap = llc->sap; |
@@ -814,7 +800,7 @@ int llc_conn_ac_send_ua_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) | |||
814 | u8 f_bit; | 800 | u8 f_bit; |
815 | int rc = -ENOBUFS; | 801 | int rc = -ENOBUFS; |
816 | struct llc_sock *llc = llc_sk(sk); | 802 | struct llc_sock *llc = llc_sk(sk); |
817 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 803 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
818 | 804 | ||
819 | llc_pdu_decode_pf_bit(skb, &f_bit); | 805 | llc_pdu_decode_pf_bit(skb, &f_bit); |
820 | if (nskb) { | 806 | if (nskb) { |
@@ -970,7 +956,7 @@ static int llc_conn_ac_send_rr_rsp_f_set_ackpf(struct sock *sk, | |||
970 | { | 956 | { |
971 | int rc = -ENOBUFS; | 957 | int rc = -ENOBUFS; |
972 | struct llc_sock *llc = llc_sk(sk); | 958 | struct llc_sock *llc = llc_sk(sk); |
973 | struct sk_buff *nskb = llc_alloc_frame(llc->dev); | 959 | struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); |
974 | 960 | ||
975 | if (nskb) { | 961 | if (nskb) { |
976 | struct llc_sap *sap = llc->sap; | 962 | struct llc_sap *sap = llc->sap; |