]> git.baikalelectronics.ru Git - kernel.git/commit
net: fix GSO for SG-enabled devices
authorPaolo Abeni <pabeni@redhat.com>
Tue, 19 Jan 2021 16:56:56 +0000 (17:56 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 20 Jan 2021 02:40:40 +0000 (18:40 -0800)
commit30ecb93bdd85357eba467c438cf22d9e0980413d
tree968d5b2e7ea5b3a40dfe048de6666b1a443768b2
parentb78a6fa8d4dd855d3f4b373d9de33e084e6e8e8c
net: fix GSO for SG-enabled devices

The commit dc259dcea8f2 ("net: move the hsize check to the else
block in skb_segment") introduced a data corruption for devices
supporting scatter-gather.

The problem boils down to signed/unsigned comparison given
unexpected results: if signed 'hsize' is negative, it will be
considered greater than a positive 'len', which is unsigned.

This commit addresses resorting to the old checks order, so that
'hsize' never has a negative value when compared with 'len'.

v1 -> v2:
 - reorder hsize checks instead of explicit cast (Alex)

Bisected-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Fixes: dc259dcea8f2 ("net: move the hsize check to the else block in skb_segment")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
Link: https://lore.kernel.org/r/861947c2d2d087db82af93c21920ce8147d15490.1611074818.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/skbuff.c