aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.c
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2017-11-15 15:23:56 -0500
committerDavid S. Miller <davem@davemloft.net>2017-11-15 20:49:00 -0500
commitd618d09a68e4eed7a435beb2e355250f6f40664a (patch)
tree293edbea3ef99f0c9c78de37a5d9dbb1b12791d7 /net/tipc/node.c
parent8252fceac01570836f0cb9e922f56b4c0b1011df (diff)
tipc: enforce valid ratio between skb truesize and contents
The socket level flow control is based on the assumption that incoming buffers meet the condition (skb->truesize / roundup(skb->len) <= 4), where the latter value is rounded off upwards to the nearest 1k number. This does empirically hold true for the device drivers we know, but we cannot trust that it will always be so, e.g., in a system with jumbo frames and very small packets. We now introduce a check for this condition at packet arrival, and if we find it to be false, we copy the packet to a new, smaller buffer, where the condition will be true. We expect this to affect only a small fraction of all incoming packets, if at all. Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r--net/tipc/node.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 009a81631280..507017fe0f1b 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1539,7 +1539,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
1539 __skb_queue_head_init(&xmitq); 1539 __skb_queue_head_init(&xmitq);
1540 1540
1541 /* Ensure message is well-formed before touching the header */ 1541 /* Ensure message is well-formed before touching the header */
1542 if (unlikely(!tipc_msg_validate(skb))) 1542 if (unlikely(!tipc_msg_validate(&skb)))
1543 goto discard; 1543 goto discard;
1544 hdr = buf_msg(skb); 1544 hdr = buf_msg(skb);
1545 usr = msg_user(hdr); 1545 usr = msg_user(hdr);