Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1279832
| From | Marcin Wojtas <mw@semihalf.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v4 net 4/6] net: mvneta: fix error path for building skb |
| Date | 2015-11-30 13:30 +0100 |
| Message-ID | <qAvKI-3zm-61@gated-at.bofh.it> (permalink) |
| References | <qAvKG-3zm-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
In the actual RX processing, there is same error path for both descriptor
ring refilling and building skb fails. This is not correct, because after
successful refill, the ring is already updated with newly allocated
buffer. Then, in case of build_skb() fail, hitherto code left the original
buffer unmapped.
This patch fixes above situation by swapping error check of skb build with
DMA-unmap of original buffer.
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Acked-by: Simon Guinot <simon.guinot@sequanux.org>
Cc: <stable@vger.kernel.org> # v4.2+
Fixes a84e32894191 ("net: mvneta: fix refilling for Rx DMA buffers")
---
drivers/net/ethernet/marvell/mvneta.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 5dffb68..5a98c5d 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -1580,12 +1580,16 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo,
}
skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size);
- if (!skb)
- goto err_drop_frame;
+ /* After refill old buffer has to be unmapped regardless
+ * the skb is successfully built or not.
+ */
dma_unmap_single(dev->dev.parent, phys_addr,
MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
+ if (!skb)
+ goto err_drop_frame;
+
rcvd_pkts++;
rcvd_bytes += rx_bytes;
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
[PATCH v4 net 2/6] net: mvneta: fix bit assignment in MVNETA_RXQ_CONFIG_REG Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
[PATCH v4 net 3/6] net: mvneta: fix bit assignment for RX packet irq enable Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
[PATCH v4 net 4/6] net: mvneta: fix error path for building skb Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
[PATCH v4 net 1/6] net: mvneta: add configuration for MBUS windows access protection Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
[PATCH v4 net 6/6] mvebu: dts: enable IP checksum with jumbo frames for Armada 38x on Port0 Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
[PATCH v4 net 5/6] net: mvneta: enable setting custom TX IP checksum limit Marcin Wojtas <mw@semihalf.com> - 2015-11-30 13:30 +0100
Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes David Miller <davem@davemloft.net> - 2015-12-02 04:10 +0100
Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes Marcin Wojtas <mw@semihalf.com> - 2015-12-02 07:10 +0100
Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes Gregory CLEMENT <gregory.clement@free-electrons.com> - 2015-12-02 09:20 +0100
Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes David Miller <davem@davemloft.net> - 2015-12-02 21:40 +0100
Re: [PATCH v4 net 0/6] Marvell Armada XP/370/38X Neta fixes Gregory CLEMENT <gregory.clement@free-electrons.com> - 2015-12-03 14:50 +0100
csiph-web