ionic: linearize tso skb with too many frags
authorShannon Nelson <snelson@pensando.io>
Wed, 17 Mar 2021 00:07:47 +0000 (17:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:32:01 +0000 (14:32 +0200)
commit6233c2d096338cd4b7ad97f1e2f84f97b06e15f0
tree3f0c343da7cb794468c8bee0143bf2fe42c71a1c
parent7637048707e53c78810d9529bda92cbc820dc488
ionic: linearize tso skb with too many frags

[ Upstream commit d2c21422323b06938b3c070361dc544f047489d7 ]

We were linearizing non-TSO skbs that had too many frags, but
we weren't checking number of frags on TSO skbs.  This could
lead to a bad page reference when we received a TSO skb with
more frags than the Tx descriptor could support.

v2: use gso_segs rather than yet another division
    don't rework the check on the nr_frags

Fixes: 0f3154e6bcb3 ("ionic: Add Tx and Rx handling")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/pensando/ionic/ionic_txrx.c