summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/tile/tilepro.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-01 19:36:42 +0400
committerDavid S. Miller <davem@davemloft.net>2013-08-02 01:35:49 +0400
commit815d3baeaefa027eb5c3c715575ab71d4eed71ec (patch)
treef83b98ee13451620cbb3008907b958080f1f34dd /drivers/net/ethernet/tile/tilepro.c
parent439a93a08407c244e9a5a5e4432ea85a2d06ec47 (diff)
downloadlinux-815d3baeaefa027eb5c3c715575ab71d4eed71ec.tar.xz
tile: avoid bug in tilepro net driver built with old hypervisor
Building against headers from an older Tilera hypervisor can cause the frags[] array to be overrun. Don't enable TSO in that case. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/tile/tilepro.c')
-rw-r--r--drivers/net/ethernet/tile/tilepro.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c
index 327ff7b687b5..2f4b7b9fa5fb 100644
--- a/drivers/net/ethernet/tile/tilepro.c
+++ b/drivers/net/ethernet/tile/tilepro.c
@@ -1929,7 +1929,7 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev)
unsigned int csum_start = skb_checksum_start_offset(skb);
- lepp_frag_t frags[LEPP_MAX_FRAGS];
+ lepp_frag_t frags[1 + MAX_SKB_FRAGS];
unsigned int num_frags;
@@ -1944,7 +1944,7 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev)
unsigned int cmd_head, cmd_tail, cmd_next;
unsigned int comp_tail;
- lepp_cmd_t cmds[LEPP_MAX_FRAGS];
+ lepp_cmd_t cmds[1 + MAX_SKB_FRAGS];
/*
@@ -2332,7 +2332,10 @@ static void tile_net_setup(struct net_device *dev)
features |= NETIF_F_LLTX;
features |= NETIF_F_HW_CSUM;
features |= NETIF_F_SG;
- features |= NETIF_F_TSO;
+
+ /* We support TSO iff the HV supports sufficient frags. */
+ if (LEPP_MAX_FRAGS >= 1 + MAX_SKB_FRAGS)
+ features |= NETIF_F_TSO;
/* We can't support HIGHDMA without hash_default, since we need
* to be able to finv() with a VA if we don't have hash_default.