]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: do not write skb_shinfo frags when doing decrytion
authorXin Long <lucien.xin@gmail.com>
Fri, 23 Jul 2021 22:46:01 +0000 (18:46 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sat, 24 Jul 2021 18:38:21 +0000 (19:38 +0100)
commit6d604faa6f4134bd4bd53baa09961acd7aec5da4
treea67b457aa6b5406e026c9aa110fcecba15904ff0
parent94ced560ab8c6d65efe864ff5a8150ff94c6a594
tipc: do not write skb_shinfo frags when doing decrytion

One skb's skb_shinfo frags are not writable, and they can be shared with
other skbs' like by pskb_copy(). To write the frags may cause other skb's
data crash.

So before doing en/decryption, skb_cow_data() should always be called for
a cloned or nonlinear skb if req dst is using the same sg as req src.
While at it, the likely branch can be removed, as it will be covered
by skb_cow_data().

Note that esp_input() has the same issue, and I will fix it in another
patch. tipc_aead_encrypt() doesn't have this issue, as it only processes
linear data in the unlikely branch.

Fixes: 4411f05d4f8c ("tipc: introduce TIPC encryption & authentication")
Reported-by: Shuang Li <shuali@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/crypto.c