]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: enforce valid ratio between skb truesize and contents
authorJon Maloy <jon.maloy@ericsson.com>
Wed, 15 Nov 2017 20:23:56 +0000 (21:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 Nov 2017 01:49:00 +0000 (10:49 +0900)
commit5e309ffd5c058f1fd5856400a5d26b2f0ec21de4
tree293edbea3ef99f0c9c78de37a5d9dbb1b12791d7
parent25e8c1846db4883c9ea273115e9807a8d413ad7c
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>
net/tipc/msg.c
net/tipc/msg.h
net/tipc/node.c