aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/bcast.c12
-rw-r--r--net/tipc/core.h24
-rw-r--r--net/tipc/discover.c6
-rw-r--r--net/tipc/link.c80
-rw-r--r--net/tipc/msg.c2
-rw-r--r--net/tipc/name_distr.c4
-rw-r--r--net/tipc/net.c4
-rw-r--r--net/tipc/node.c4
-rw-r--r--net/tipc/port.c14
-rw-r--r--net/tipc/socket.c8
10 files changed, 67 insertions, 91 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 41ecf313073c..e00441a2092f 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -256,7 +256,7 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
256 if (bcbuf_acks(crs) == 0) { 256 if (bcbuf_acks(crs) == 0) {
257 bcl->first_out = next; 257 bcl->first_out = next;
258 bcl->out_queue_size--; 258 bcl->out_queue_size--;
259 buf_discard(crs); 259 kfree_skb(crs);
260 released = 1; 260 released = 1;
261 } 261 }
262 crs = next; 262 crs = next;
@@ -330,7 +330,7 @@ void tipc_bclink_update_link_state(struct tipc_node *n_ptr, u32 last_sent)
330 tipc_bearer_send(&bcbearer->bearer, buf, NULL); 330 tipc_bearer_send(&bcbearer->bearer, buf, NULL);
331 bcl->stats.sent_nacks++; 331 bcl->stats.sent_nacks++;
332 spin_unlock_bh(&bc_lock); 332 spin_unlock_bh(&bc_lock);
333 buf_discard(buf); 333 kfree_skb(buf);
334 334
335 n_ptr->bclink.oos_state++; 335 n_ptr->bclink.oos_state++;
336 } 336 }
@@ -374,7 +374,7 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
374 374
375 if (!bclink->bcast_nodes.count) { 375 if (!bclink->bcast_nodes.count) {
376 res = msg_data_sz(buf_msg(buf)); 376 res = msg_data_sz(buf_msg(buf));
377 buf_discard(buf); 377 kfree_skb(buf);
378 goto exit; 378 goto exit;
379 } 379 }
380 380
@@ -480,7 +480,7 @@ receive:
480 if (likely(msg_mcast(msg))) 480 if (likely(msg_mcast(msg)))
481 tipc_port_recv_mcast(buf, NULL); 481 tipc_port_recv_mcast(buf, NULL);
482 else 482 else
483 buf_discard(buf); 483 kfree_skb(buf);
484 } else if (msg_user(msg) == MSG_BUNDLER) { 484 } else if (msg_user(msg) == MSG_BUNDLER) {
485 spin_lock_bh(&bc_lock); 485 spin_lock_bh(&bc_lock);
486 bclink_accept_pkt(node, seqno); 486 bclink_accept_pkt(node, seqno);
@@ -513,7 +513,7 @@ receive:
513 bclink_accept_pkt(node, seqno); 513 bclink_accept_pkt(node, seqno);
514 spin_unlock_bh(&bc_lock); 514 spin_unlock_bh(&bc_lock);
515 tipc_node_unlock(node); 515 tipc_node_unlock(node);
516 buf_discard(buf); 516 kfree_skb(buf);
517 } 517 }
518 buf = NULL; 518 buf = NULL;
519 519
@@ -569,7 +569,7 @@ receive:
569unlock: 569unlock:
570 tipc_node_unlock(node); 570 tipc_node_unlock(node);
571exit: 571exit:
572 buf_discard(buf); 572 kfree_skb(buf);
573} 573}
574 574
575u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr) 575u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr)
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 1260b053bf25..aefe1869572e 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -269,28 +269,4 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
269 269
270extern struct sk_buff *tipc_buf_acquire(u32 size); 270extern struct sk_buff *tipc_buf_acquire(u32 size);
271 271
272/**
273 * buf_discard - frees a TIPC message buffer
274 * @skb: message buffer
275 *
276 * Frees a message buffer. If passed NULL, just returns.
277 */
278
279static inline void buf_discard(struct sk_buff *skb)
280{
281 kfree_skb(skb);
282}
283
284/**
285 * buf_linearize - convert a TIPC message buffer into a single contiguous piece
286 * @skb: message buffer
287 *
288 * Returns 0 on success.
289 */
290
291static inline int buf_linearize(struct sk_buff *skb)
292{
293 return skb_linearize(skb);
294}
295
296#endif 272#endif
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index f5f9bf7a0436..c630a21b2bed 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -135,7 +135,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
135 135
136 media_addr.broadcast = 1; 136 media_addr.broadcast = 1;
137 b_ptr->media->msg2addr(&media_addr, msg_media_addr(msg)); 137 b_ptr->media->msg2addr(&media_addr, msg_media_addr(msg));
138 buf_discard(buf); 138 kfree_skb(buf);
139 139
140 /* Ensure message from node is valid and communication is permitted */ 140 /* Ensure message from node is valid and communication is permitted */
141 if (net_id != tipc_net_id) 141 if (net_id != tipc_net_id)
@@ -250,7 +250,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
250 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, orig, b_ptr); 250 rbuf = tipc_disc_init_msg(DSC_RESP_MSG, orig, b_ptr);
251 if (rbuf) { 251 if (rbuf) {
252 b_ptr->media->send_msg(rbuf, b_ptr, &media_addr); 252 b_ptr->media->send_msg(rbuf, b_ptr, &media_addr);
253 buf_discard(rbuf); 253 kfree_skb(rbuf);
254 } 254 }
255 } 255 }
256 256
@@ -396,7 +396,7 @@ void tipc_disc_delete(struct tipc_link_req *req)
396{ 396{
397 k_cancel_timer(&req->timer); 397 k_cancel_timer(&req->timer);
398 k_term_timer(&req->timer); 398 k_term_timer(&req->timer);
399 buf_discard(req->buf); 399 kfree_skb(req->buf);
400 kfree(req); 400 kfree(req);
401} 401}
402 402
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 6cc78a970126..f16e65dd50c0 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -484,7 +484,7 @@ static void link_release_outqueue(struct tipc_link *l_ptr)
484 484
485 while (buf) { 485 while (buf) {
486 next = buf->next; 486 next = buf->next;
487 buf_discard(buf); 487 kfree_skb(buf);
488 buf = next; 488 buf = next;
489 } 489 }
490 l_ptr->first_out = NULL; 490 l_ptr->first_out = NULL;
@@ -503,7 +503,7 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr)
503 503
504 while (buf) { 504 while (buf) {
505 next = buf->next; 505 next = buf->next;
506 buf_discard(buf); 506 kfree_skb(buf);
507 buf = next; 507 buf = next;
508 } 508 }
509 l_ptr->defragm_buf = NULL; 509 l_ptr->defragm_buf = NULL;
@@ -522,20 +522,20 @@ void tipc_link_stop(struct tipc_link *l_ptr)
522 buf = l_ptr->oldest_deferred_in; 522 buf = l_ptr->oldest_deferred_in;
523 while (buf) { 523 while (buf) {
524 next = buf->next; 524 next = buf->next;
525 buf_discard(buf); 525 kfree_skb(buf);
526 buf = next; 526 buf = next;
527 } 527 }
528 528
529 buf = l_ptr->first_out; 529 buf = l_ptr->first_out;
530 while (buf) { 530 while (buf) {
531 next = buf->next; 531 next = buf->next;
532 buf_discard(buf); 532 kfree_skb(buf);
533 buf = next; 533 buf = next;
534 } 534 }
535 535
536 tipc_link_reset_fragments(l_ptr); 536 tipc_link_reset_fragments(l_ptr);
537 537
538 buf_discard(l_ptr->proto_msg_queue); 538 kfree_skb(l_ptr->proto_msg_queue);
539 l_ptr->proto_msg_queue = NULL; 539 l_ptr->proto_msg_queue = NULL;
540} 540}
541 541
@@ -571,12 +571,12 @@ void tipc_link_reset(struct tipc_link *l_ptr)
571 /* Clean up all queues: */ 571 /* Clean up all queues: */
572 572
573 link_release_outqueue(l_ptr); 573 link_release_outqueue(l_ptr);
574 buf_discard(l_ptr->proto_msg_queue); 574 kfree_skb(l_ptr->proto_msg_queue);
575 l_ptr->proto_msg_queue = NULL; 575 l_ptr->proto_msg_queue = NULL;
576 buf = l_ptr->oldest_deferred_in; 576 buf = l_ptr->oldest_deferred_in;
577 while (buf) { 577 while (buf) {
578 struct sk_buff *next = buf->next; 578 struct sk_buff *next = buf->next;
579 buf_discard(buf); 579 kfree_skb(buf);
580 buf = next; 580 buf = next;
581 } 581 }
582 if (!list_empty(&l_ptr->waiting_ports)) 582 if (!list_empty(&l_ptr->waiting_ports))
@@ -810,7 +810,7 @@ static int link_bundle_buf(struct tipc_link *l_ptr,
810 skb_copy_to_linear_data_offset(bundler, to_pos, buf->data, size); 810 skb_copy_to_linear_data_offset(bundler, to_pos, buf->data, size);
811 msg_set_size(bundler_msg, to_pos + size); 811 msg_set_size(bundler_msg, to_pos + size);
812 msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1); 812 msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1);
813 buf_discard(buf); 813 kfree_skb(buf);
814 l_ptr->stats.sent_bundled++; 814 l_ptr->stats.sent_bundled++;
815 return 1; 815 return 1;
816} 816}
@@ -878,10 +878,10 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
878 if (unlikely(queue_size >= queue_limit)) { 878 if (unlikely(queue_size >= queue_limit)) {
879 if (imp <= TIPC_CRITICAL_IMPORTANCE) { 879 if (imp <= TIPC_CRITICAL_IMPORTANCE) {
880 link_schedule_port(l_ptr, msg_origport(msg), size); 880 link_schedule_port(l_ptr, msg_origport(msg), size);
881 buf_discard(buf); 881 kfree_skb(buf);
882 return -ELINKCONG; 882 return -ELINKCONG;
883 } 883 }
884 buf_discard(buf); 884 kfree_skb(buf);
885 if (imp > CONN_MANAGER) { 885 if (imp > CONN_MANAGER) {
886 warn("Resetting link <%s>, send queue full", l_ptr->name); 886 warn("Resetting link <%s>, send queue full", l_ptr->name);
887 tipc_link_reset(l_ptr); 887 tipc_link_reset(l_ptr);
@@ -968,10 +968,10 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
968 if (l_ptr) 968 if (l_ptr)
969 res = tipc_link_send_buf(l_ptr, buf); 969 res = tipc_link_send_buf(l_ptr, buf);
970 else 970 else
971 buf_discard(buf); 971 kfree_skb(buf);
972 tipc_node_unlock(n_ptr); 972 tipc_node_unlock(n_ptr);
973 } else { 973 } else {
974 buf_discard(buf); 974 kfree_skb(buf);
975 } 975 }
976 read_unlock_bh(&tipc_net_lock); 976 read_unlock_bh(&tipc_net_lock);
977 return res; 977 return res;
@@ -1018,7 +1018,7 @@ void tipc_link_send_names(struct list_head *message_list, u32 dest)
1018 1018
1019 list_for_each_safe(buf, temp_buf, ((struct sk_buff *)message_list)) { 1019 list_for_each_safe(buf, temp_buf, ((struct sk_buff *)message_list)) {
1020 list_del((struct list_head *)buf); 1020 list_del((struct list_head *)buf);
1021 buf_discard(buf); 1021 kfree_skb(buf);
1022 } 1022 }
1023} 1023}
1024 1024
@@ -1262,7 +1262,7 @@ again:
1262error: 1262error:
1263 for (; buf_chain; buf_chain = buf) { 1263 for (; buf_chain; buf_chain = buf) {
1264 buf = buf_chain->next; 1264 buf = buf_chain->next;
1265 buf_discard(buf_chain); 1265 kfree_skb(buf_chain);
1266 } 1266 }
1267 return -EFAULT; 1267 return -EFAULT;
1268 } 1268 }
@@ -1316,7 +1316,7 @@ error:
1316 tipc_node_unlock(node); 1316 tipc_node_unlock(node);
1317 for (; buf_chain; buf_chain = buf) { 1317 for (; buf_chain; buf_chain = buf) {
1318 buf = buf_chain->next; 1318 buf = buf_chain->next;
1319 buf_discard(buf_chain); 1319 kfree_skb(buf_chain);
1320 } 1320 }
1321 goto again; 1321 goto again;
1322 } 1322 }
@@ -1324,7 +1324,7 @@ error:
1324reject: 1324reject:
1325 for (; buf_chain; buf_chain = buf) { 1325 for (; buf_chain; buf_chain = buf) {
1326 buf = buf_chain->next; 1326 buf = buf_chain->next;
1327 buf_discard(buf_chain); 1327 kfree_skb(buf_chain);
1328 } 1328 }
1329 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect, 1329 return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
1330 total_len, TIPC_ERR_NO_NODE); 1330 total_len, TIPC_ERR_NO_NODE);
@@ -1390,7 +1390,7 @@ u32 tipc_link_push_packet(struct tipc_link *l_ptr)
1390 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); 1390 msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in);
1391 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { 1391 if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
1392 l_ptr->unacked_window = 0; 1392 l_ptr->unacked_window = 0;
1393 buf_discard(buf); 1393 kfree_skb(buf);
1394 l_ptr->proto_msg_queue = NULL; 1394 l_ptr->proto_msg_queue = NULL;
1395 return 0; 1395 return 0;
1396 } else { 1396 } else {
@@ -1679,7 +1679,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1679 1679
1680 /* Ensure message data is a single contiguous unit */ 1680 /* Ensure message data is a single contiguous unit */
1681 1681
1682 if (unlikely(buf_linearize(buf))) 1682 if (unlikely(skb_linearize(buf)))
1683 goto cont; 1683 goto cont;
1684 1684
1685 /* Handle arrival of a non-unicast link message */ 1685 /* Handle arrival of a non-unicast link message */
@@ -1744,7 +1744,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
1744 less_eq(buf_seqno(crs), ackd)) { 1744 less_eq(buf_seqno(crs), ackd)) {
1745 struct sk_buff *next = crs->next; 1745 struct sk_buff *next = crs->next;
1746 1746
1747 buf_discard(crs); 1747 kfree_skb(crs);
1748 crs = next; 1748 crs = next;
1749 released++; 1749 released++;
1750 } 1750 }
@@ -1820,7 +1820,7 @@ deliver:
1820 } 1820 }
1821 break; 1821 break;
1822 default: 1822 default:
1823 buf_discard(buf); 1823 kfree_skb(buf);
1824 buf = NULL; 1824 buf = NULL;
1825 break; 1825 break;
1826 } 1826 }
@@ -1851,7 +1851,7 @@ deliver:
1851 } 1851 }
1852 tipc_node_unlock(n_ptr); 1852 tipc_node_unlock(n_ptr);
1853cont: 1853cont:
1854 buf_discard(buf); 1854 kfree_skb(buf);
1855 } 1855 }
1856 read_unlock_bh(&tipc_net_lock); 1856 read_unlock_bh(&tipc_net_lock);
1857} 1857}
@@ -1891,7 +1891,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
1891 u32 curr_seqno = buf_seqno(queue_buf); 1891 u32 curr_seqno = buf_seqno(queue_buf);
1892 1892
1893 if (seq_no == curr_seqno) { 1893 if (seq_no == curr_seqno) {
1894 buf_discard(buf); 1894 kfree_skb(buf);
1895 return 0; 1895 return 0;
1896 } 1896 }
1897 1897
@@ -1932,7 +1932,7 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
1932 1932
1933 if (less(seq_no, mod(l_ptr->next_in_no))) { 1933 if (less(seq_no, mod(l_ptr->next_in_no))) {
1934 l_ptr->stats.duplicates++; 1934 l_ptr->stats.duplicates++;
1935 buf_discard(buf); 1935 kfree_skb(buf);
1936 return; 1936 return;
1937 } 1937 }
1938 1938
@@ -1961,7 +1961,7 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
1961 /* Discard any previous message that was deferred due to congestion */ 1961 /* Discard any previous message that was deferred due to congestion */
1962 1962
1963 if (l_ptr->proto_msg_queue) { 1963 if (l_ptr->proto_msg_queue) {
1964 buf_discard(l_ptr->proto_msg_queue); 1964 kfree_skb(l_ptr->proto_msg_queue);
1965 l_ptr->proto_msg_queue = NULL; 1965 l_ptr->proto_msg_queue = NULL;
1966 } 1966 }
1967 1967
@@ -2060,7 +2060,7 @@ void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
2060 /* Discard message if it was sent successfully */ 2060 /* Discard message if it was sent successfully */
2061 2061
2062 l_ptr->unacked_window = 0; 2062 l_ptr->unacked_window = 0;
2063 buf_discard(buf); 2063 kfree_skb(buf);
2064} 2064}
2065 2065
2066/* 2066/*
@@ -2204,7 +2204,7 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2204 break; 2204 break;
2205 } 2205 }
2206exit: 2206exit:
2207 buf_discard(buf); 2207 kfree_skb(buf);
2208} 2208}
2209 2209
2210 2210
@@ -2402,7 +2402,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2402 warn("Link changeover error, duplicate msg dropped\n"); 2402 warn("Link changeover error, duplicate msg dropped\n");
2403 goto exit; 2403 goto exit;
2404 } 2404 }
2405 buf_discard(tunnel_buf); 2405 kfree_skb(tunnel_buf);
2406 return 1; 2406 return 1;
2407 } 2407 }
2408 2408
@@ -2434,7 +2434,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2434 } else { 2434 } else {
2435 *buf = buf_extract(tunnel_buf, INT_H_SIZE); 2435 *buf = buf_extract(tunnel_buf, INT_H_SIZE);
2436 if (*buf != NULL) { 2436 if (*buf != NULL) {
2437 buf_discard(tunnel_buf); 2437 kfree_skb(tunnel_buf);
2438 return 1; 2438 return 1;
2439 } else { 2439 } else {
2440 warn("Link changeover error, original msg dropped\n"); 2440 warn("Link changeover error, original msg dropped\n");
@@ -2442,7 +2442,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2442 } 2442 }
2443exit: 2443exit:
2444 *buf = NULL; 2444 *buf = NULL;
2445 buf_discard(tunnel_buf); 2445 kfree_skb(tunnel_buf);
2446 return 0; 2446 return 0;
2447} 2447}
2448 2448
@@ -2464,7 +2464,7 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
2464 pos += align(msg_size(buf_msg(obuf))); 2464 pos += align(msg_size(buf_msg(obuf)));
2465 tipc_net_route_msg(obuf); 2465 tipc_net_route_msg(obuf);
2466 } 2466 }
2467 buf_discard(buf); 2467 kfree_skb(buf);
2468} 2468}
2469 2469
2470/* 2470/*
@@ -2513,11 +2513,11 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
2513 } 2513 }
2514 fragm = tipc_buf_acquire(fragm_sz + INT_H_SIZE); 2514 fragm = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
2515 if (fragm == NULL) { 2515 if (fragm == NULL) {
2516 buf_discard(buf); 2516 kfree_skb(buf);
2517 while (buf_chain) { 2517 while (buf_chain) {
2518 buf = buf_chain; 2518 buf = buf_chain;
2519 buf_chain = buf_chain->next; 2519 buf_chain = buf_chain->next;
2520 buf_discard(buf); 2520 kfree_skb(buf);
2521 } 2521 }
2522 return -ENOMEM; 2522 return -ENOMEM;
2523 } 2523 }
@@ -2534,7 +2534,7 @@ static int link_send_long_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
2534 crs += fragm_sz; 2534 crs += fragm_sz;
2535 msg_set_type(&fragm_hdr, FRAGMENT); 2535 msg_set_type(&fragm_hdr, FRAGMENT);
2536 } 2536 }
2537 buf_discard(buf); 2537 kfree_skb(buf);
2538 2538
2539 /* Append chain of fragments to send queue & send them */ 2539 /* Append chain of fragments to send queue & send them */
2540 2540
@@ -2621,7 +2621,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2621 if (msg_type(imsg) == TIPC_MCAST_MSG) 2621 if (msg_type(imsg) == TIPC_MCAST_MSG)
2622 max = TIPC_MAX_USER_MSG_SIZE + MCAST_H_SIZE; 2622 max = TIPC_MAX_USER_MSG_SIZE + MCAST_H_SIZE;
2623 if (msg_size(imsg) > max) { 2623 if (msg_size(imsg) > max) {
2624 buf_discard(fbuf); 2624 kfree_skb(fbuf);
2625 return 0; 2625 return 0;
2626 } 2626 }
2627 pbuf = tipc_buf_acquire(msg_size(imsg)); 2627 pbuf = tipc_buf_acquire(msg_size(imsg));
@@ -2637,10 +2637,10 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2637 set_expected_frags(pbuf, exp_fragm_cnt - 1); 2637 set_expected_frags(pbuf, exp_fragm_cnt - 1);
2638 } else { 2638 } else {
2639 dbg("Link unable to reassemble fragmented message\n"); 2639 dbg("Link unable to reassemble fragmented message\n");
2640 buf_discard(fbuf); 2640 kfree_skb(fbuf);
2641 return -1; 2641 return -1;
2642 } 2642 }
2643 buf_discard(fbuf); 2643 kfree_skb(fbuf);
2644 return 0; 2644 return 0;
2645 } else if (pbuf && (msg_type(fragm) != FIRST_FRAGMENT)) { 2645 } else if (pbuf && (msg_type(fragm) != FIRST_FRAGMENT)) {
2646 u32 dsz = msg_data_sz(fragm); 2646 u32 dsz = msg_data_sz(fragm);
@@ -2649,7 +2649,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2649 u32 exp_frags = get_expected_frags(pbuf) - 1; 2649 u32 exp_frags = get_expected_frags(pbuf) - 1;
2650 skb_copy_to_linear_data_offset(pbuf, crs, 2650 skb_copy_to_linear_data_offset(pbuf, crs,
2651 msg_data(fragm), dsz); 2651 msg_data(fragm), dsz);
2652 buf_discard(fbuf); 2652 kfree_skb(fbuf);
2653 2653
2654 /* Is message complete? */ 2654 /* Is message complete? */
2655 2655
@@ -2666,7 +2666,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2666 set_expected_frags(pbuf, exp_frags); 2666 set_expected_frags(pbuf, exp_frags);
2667 return 0; 2667 return 0;
2668 } 2668 }
2669 buf_discard(fbuf); 2669 kfree_skb(fbuf);
2670 return 0; 2670 return 0;
2671} 2671}
2672 2672
@@ -2697,7 +2697,7 @@ static void link_check_defragm_bufs(struct tipc_link *l_ptr)
2697 prev->next = buf->next; 2697 prev->next = buf->next;
2698 else 2698 else
2699 l_ptr->defragm_buf = buf->next; 2699 l_ptr->defragm_buf = buf->next;
2700 buf_discard(buf); 2700 kfree_skb(buf);
2701 } 2701 }
2702 buf = next; 2702 buf = next;
2703 } 2703 }
@@ -3072,7 +3072,7 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s
3072 str_len = tipc_link_stats((char *)TLV_DATA(req_tlv_area), 3072 str_len = tipc_link_stats((char *)TLV_DATA(req_tlv_area),
3073 (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO); 3073 (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO);
3074 if (!str_len) { 3074 if (!str_len) {
3075 buf_discard(buf); 3075 kfree_skb(buf);
3076 return tipc_cfg_reply_error_string("link not found"); 3076 return tipc_cfg_reply_error_string("link not found");
3077 } 3077 }
3078 3078
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 3e4d3e29be61..e3afe162c0ac 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -106,7 +106,7 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
106 if (likely(res)) 106 if (likely(res))
107 return dsz; 107 return dsz;
108 108
109 buf_discard(*buf); 109 kfree_skb(*buf);
110 *buf = NULL; 110 *buf = NULL;
111 return -EFAULT; 111 return -EFAULT;
112} 112}
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index acecfda82f37..d57da6159616 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -120,7 +120,7 @@ static void named_cluster_distribute(struct sk_buff *buf)
120 } 120 }
121 } 121 }
122 122
123 buf_discard(buf); 123 kfree_skb(buf);
124} 124}
125 125
126/** 126/**
@@ -312,7 +312,7 @@ void tipc_named_recv(struct sk_buff *buf)
312 item++; 312 item++;
313 } 313 }
314 write_unlock_bh(&tipc_nametbl_lock); 314 write_unlock_bh(&tipc_nametbl_lock);
315 buf_discard(buf); 315 kfree_skb(buf);
316} 316}
317 317
318/** 318/**
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 61afee7e8291..2abd4be4933e 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -117,7 +117,7 @@ static void net_route_named_msg(struct sk_buff *buf)
117 u32 dport; 117 u32 dport;
118 118
119 if (!msg_named(msg)) { 119 if (!msg_named(msg)) {
120 buf_discard(buf); 120 kfree_skb(buf);
121 return; 121 return;
122 } 122 }
123 123
@@ -161,7 +161,7 @@ void tipc_net_route_msg(struct sk_buff *buf)
161 tipc_port_recv_proto_msg(buf); 161 tipc_port_recv_proto_msg(buf);
162 break; 162 break;
163 default: 163 default:
164 buf_discard(buf); 164 kfree_skb(buf);
165 } 165 }
166 return; 166 return;
167 } 167 }
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 1790f503f57b..24c42f7568ac 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -353,12 +353,12 @@ static void node_lost_contact(struct tipc_node *n_ptr)
353 while (n_ptr->bclink.deferred_head) { 353 while (n_ptr->bclink.deferred_head) {
354 struct sk_buff *buf = n_ptr->bclink.deferred_head; 354 struct sk_buff *buf = n_ptr->bclink.deferred_head;
355 n_ptr->bclink.deferred_head = buf->next; 355 n_ptr->bclink.deferred_head = buf->next;
356 buf_discard(buf); 356 kfree_skb(buf);
357 } 357 }
358 n_ptr->bclink.deferred_size = 0; 358 n_ptr->bclink.deferred_size = 0;
359 359
360 if (n_ptr->bclink.defragm) { 360 if (n_ptr->bclink.defragm) {
361 buf_discard(n_ptr->bclink.defragm); 361 kfree_skb(n_ptr->bclink.defragm);
362 n_ptr->bclink.defragm = NULL; 362 n_ptr->bclink.defragm = NULL;
363 } 363 }
364 364
diff --git a/net/tipc/port.c b/net/tipc/port.c
index ba3268b8da42..c4b5a347037a 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -116,13 +116,13 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
116 ibuf = skb_copy(buf, GFP_ATOMIC); 116 ibuf = skb_copy(buf, GFP_ATOMIC);
117 if (ibuf == NULL) { 117 if (ibuf == NULL) {
118 tipc_port_list_free(&dports); 118 tipc_port_list_free(&dports);
119 buf_discard(buf); 119 kfree_skb(buf);
120 return -ENOMEM; 120 return -ENOMEM;
121 } 121 }
122 } 122 }
123 res = tipc_bclink_send_msg(buf); 123 res = tipc_bclink_send_msg(buf);
124 if ((res < 0) && (dports.count != 0)) 124 if ((res < 0) && (dports.count != 0))
125 buf_discard(ibuf); 125 kfree_skb(ibuf);
126 } else { 126 } else {
127 ibuf = buf; 127 ibuf = buf;
128 } 128 }
@@ -187,7 +187,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
187 } 187 }
188 } 188 }
189exit: 189exit:
190 buf_discard(buf); 190 kfree_skb(buf);
191 tipc_port_list_free(dp); 191 tipc_port_list_free(dp);
192} 192}
193 193
@@ -420,7 +420,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
420 else 420 else
421 tipc_link_send(rbuf, src_node, msg_link_selector(rmsg)); 421 tipc_link_send(rbuf, src_node, msg_link_selector(rmsg));
422exit: 422exit:
423 buf_discard(buf); 423 kfree_skb(buf);
424 return data_sz; 424 return data_sz;
425} 425}
426 426
@@ -568,7 +568,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
568 tipc_port_unlock(p_ptr); 568 tipc_port_unlock(p_ptr);
569exit: 569exit:
570 tipc_net_route_msg(r_buf); 570 tipc_net_route_msg(r_buf);
571 buf_discard(buf); 571 kfree_skb(buf);
572} 572}
573 573
574static void port_print(struct tipc_port *p_ptr, struct print_buf *buf, int full_id) 574static void port_print(struct tipc_port *p_ptr, struct print_buf *buf, int full_id)
@@ -759,7 +759,7 @@ static void port_dispatcher_sigh(void *dummy)
759 } 759 }
760 } 760 }
761 if (buf) 761 if (buf)
762 buf_discard(buf); 762 kfree_skb(buf);
763 buf = next; 763 buf = next;
764 continue; 764 continue;
765err: 765err:
@@ -813,7 +813,7 @@ err:
813 } 813 }
814 } 814 }
815 if (buf) 815 if (buf)
816 buf_discard(buf); 816 kfree_skb(buf);
817 buf = next; 817 buf = next;
818 continue; 818 continue;
819reject: 819reject:
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index d3227f2a216e..29e957f64458 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -126,7 +126,7 @@ static atomic_t tipc_queue_size = ATOMIC_INIT(0);
126 126
127static void advance_rx_queue(struct sock *sk) 127static void advance_rx_queue(struct sock *sk)
128{ 128{
129 buf_discard(__skb_dequeue(&sk->sk_receive_queue)); 129 kfree_skb(__skb_dequeue(&sk->sk_receive_queue));
130 atomic_dec(&tipc_queue_size); 130 atomic_dec(&tipc_queue_size);
131} 131}
132 132
@@ -142,7 +142,7 @@ static void discard_rx_queue(struct sock *sk)
142 142
143 while ((buf = __skb_dequeue(&sk->sk_receive_queue))) { 143 while ((buf = __skb_dequeue(&sk->sk_receive_queue))) {
144 atomic_dec(&tipc_queue_size); 144 atomic_dec(&tipc_queue_size);
145 buf_discard(buf); 145 kfree_skb(buf);
146 } 146 }
147} 147}
148 148
@@ -288,7 +288,7 @@ static int release(struct socket *sock)
288 break; 288 break;
289 atomic_dec(&tipc_queue_size); 289 atomic_dec(&tipc_queue_size);
290 if (TIPC_SKB_CB(buf)->handle != 0) 290 if (TIPC_SKB_CB(buf)->handle != 0)
291 buf_discard(buf); 291 kfree_skb(buf);
292 else { 292 else {
293 if ((sock->state == SS_CONNECTING) || 293 if ((sock->state == SS_CONNECTING) ||
294 (sock->state == SS_CONNECTED)) { 294 (sock->state == SS_CONNECTED)) {
@@ -1615,7 +1615,7 @@ restart:
1615 if (buf) { 1615 if (buf) {
1616 atomic_dec(&tipc_queue_size); 1616 atomic_dec(&tipc_queue_size);
1617 if (TIPC_SKB_CB(buf)->handle != 0) { 1617 if (TIPC_SKB_CB(buf)->handle != 0) {
1618 buf_discard(buf); 1618 kfree_skb(buf);
1619 goto restart; 1619 goto restart;
1620 } 1620 }
1621 tipc_disconnect(tport->ref); 1621 tipc_disconnect(tport->ref);