net/sfc: fix crash in EF10 TSO if no payload
authorIgor Romanov <igor.romanov@oktetlabs.ru>
Wed, 23 Jan 2019 13:08:55 +0000 (13:08 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 24 Jan 2019 09:08:31 +0000 (10:08 +0100)
Fixes: 6bc985e41155 ("net/sfc: support TSO in EF10 Tx datapath")
Cc: stable@dpdk.org
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/sfc_ef10_tx.c

index bcd3153..ff6d5b4 100644 (file)
@@ -381,6 +381,9 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg,
                hdr_addr = rte_pktmbuf_mtod(m_seg, uint8_t *);
                hdr_iova = rte_mbuf_data_iova(m_seg);
                if (rte_pktmbuf_data_len(m_seg) == header_len) {
+                       /* Cannot send a packet that consists only of header */
+                       if (unlikely(m_seg->next == NULL))
+                               return EMSGSIZE;
                        /*
                         * Associate header mbuf with header descriptor
                         * which is located after TSO descriptors.
@@ -409,6 +412,10 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg,
                copied_segs = sfc_tso_prepare_header(hdr_addr, header_len,
                                                     &m_seg, &in_off);
 
+               /* Cannot send a packet that consists only of header */
+               if (unlikely(m_seg == NULL))
+                       return EMSGSIZE;
+
                m_seg_to_free_up_to = m_seg;
                /*
                 * Reduce the number of needed descriptors by the number of