• Tung Nguyen's avatar
    tipc: eliminate buffer cloning in function tipc_msg_extract() · ef9be755
    Tung Nguyen authored
    The function tipc_msg_extract() is using skb_clone() to clone inner
    messages from a message bundle buffer. Although this method is safe,
    it has an undesired effect that each buffer clone inherits the
    true-size of the bundling buffer. As a result, the buffer clone
    almost always ends up with being copied anyway by the message
    validation function. This makes the cloning into a sub-optimization.
    
    In this commit we take the consequence of this realization, and copy
    each inner message to a separately allocated buffer up front in the
    extraction function.
    
    As a bonus we can now eliminate the two cases where we had to copy
    re-routed packets that may potentially go out on the wire again.
    Signed-off-by: default avatarTung Nguyen <tung.q.nguyen@dektech.com.au>
    Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ef9be755
msg.c 18.8 KB