* [PATCH] nfp: fix infinite loop on umapping cleanup
@ 2017-08-18 11:11 Colin King
2017-08-18 14:32 ` [oss-drivers] " Jakub Kicinski
2017-08-18 17:29 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-08-18 11:11 UTC (permalink / raw)
To: David S . Miller, Simon Horman, Daniel Borkmann, oss-drivers,
netdev
Cc: Jakub Kicinski, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The while loop that performs the dma page unmapping never decrements
index counter f and hence loops forever. Fix this with a pre-decrement
on f.
Detected by CoverityScan, CID#1357309 ("Infinite loop")
Fixes: 4c3523623dc0 ("net: add driver for Netronome NFP4000/NFP6000 NIC VFs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 4a990033c4d5..732f1d315fba 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -908,8 +908,7 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
return NETDEV_TX_OK;
err_unmap:
- --f;
- while (f >= 0) {
+ while (--f >= 0) {
frag = &skb_shinfo(skb)->frags[f];
dma_unmap_page(dp->dev, tx_ring->txbufs[wr_idx].dma_addr,
skb_frag_size(frag), DMA_TO_DEVICE);
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [oss-drivers] [PATCH] nfp: fix infinite loop on umapping cleanup
2017-08-18 11:11 [PATCH] nfp: fix infinite loop on umapping cleanup Colin King
@ 2017-08-18 14:32 ` Jakub Kicinski
2017-08-18 17:29 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2017-08-18 14:32 UTC (permalink / raw)
To: Colin King
Cc: David S . Miller, Simon Horman, Daniel Borkmann, oss-drivers,
netdev, linux-kernel
On Fri, 18 Aug 2017 12:11:50 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The while loop that performs the dma page unmapping never decrements
> index counter f and hence loops forever. Fix this with a pre-decrement
> on f.
>
> Detected by CoverityScan, CID#1357309 ("Infinite loop")
>
> Fixes: 4c3523623dc0 ("net: add driver for Netronome NFP4000/NFP6000 NIC VFs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nfp: fix infinite loop on umapping cleanup
2017-08-18 11:11 [PATCH] nfp: fix infinite loop on umapping cleanup Colin King
2017-08-18 14:32 ` [oss-drivers] " Jakub Kicinski
@ 2017-08-18 17:29 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-08-18 17:29 UTC (permalink / raw)
To: colin.king
Cc: simon.horman, daniel, oss-drivers, netdev, jakub.kicinski,
linux-kernel
From: Colin King <colin.king@canonical.com>
Date: Fri, 18 Aug 2017 12:11:50 +0100
> From: Colin Ian King <colin.king@canonical.com>
>
> The while loop that performs the dma page unmapping never decrements
> index counter f and hence loops forever. Fix this with a pre-decrement
> on f.
>
> Detected by CoverityScan, CID#1357309 ("Infinite loop")
>
> Fixes: 4c3523623dc0 ("net: add driver for Netronome NFP4000/NFP6000 NIC VFs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-18 17:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-18 11:11 [PATCH] nfp: fix infinite loop on umapping cleanup Colin King
2017-08-18 14:32 ` [oss-drivers] " Jakub Kicinski
2017-08-18 17:29 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).