]> git.baikalelectronics.ru Git - kernel.git/commit
mac80211: fix fragmentation code, particularly for encryption
authorJohannes Berg <johannes.berg@intel.com>
Fri, 31 Jan 2014 23:16:23 +0000 (00:16 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 6 Feb 2014 08:55:21 +0000 (09:55 +0100)
commit24d507c687dcc12812e3caf1bc6a7323897fbaa4
treebd48e6d563efb293c2693458209841747b4ed1cb
parenta0ff102611ea30720f561f3f5cab3c0b248bc173
mac80211: fix fragmentation code, particularly for encryption

The "new" fragmentation code (since my rewrite almost 5 years ago)
erroneously sets skb->len rather than using skb_trim() to adjust
the length of the first fragment after copying out all the others.
This leaves the skb tail pointer pointing to after where the data
originally ended, and thus causes the encryption MIC to be written
at that point, rather than where it belongs: immediately after the
data.

The impact of this is that if software encryption is done, then
 a) encryption doesn't work for the first fragment, the connection
    becomes unusable as the first fragment will never be properly
    verified at the receiver, the MIC is practically guaranteed to
    be wrong
 b) we leak up to 8 bytes of plaintext (!) of the packet out into
    the air

This is only mitigated by the fact that many devices are capable
of doing encryption in hardware, in which case this can't happen
as the tail pointer is irrelevant in that case. Additionally,
fragmentation is not used very frequently and would normally have
to be configured manually.

Fix this by using skb_trim() properly.

Cc: stable@vger.kernel.org
Fixes: c7da59ea945b ("mac80211: rewrite fragmentation")
Reported-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/tx.c