netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: brouer@redhat.com
Cc: ecree@solarflare.com, netdev@vger.kernel.org
Subject: Re: [net-next PATCH] net: ipv4: fix listify ip_rcv_finish in case of forwarding
Date: Thu, 12 Jul 2018 16:41:42 -0700 (PDT)	[thread overview]
Message-ID: <20180712.164142.1404268131433458085.davem@davemloft.net> (raw)
In-Reply-To: <153132125549.13161.16380200872856218805.stgit@firesoul>

From: Jesper Dangaard Brouer <brouer@redhat.com>
Date: Wed, 11 Jul 2018 17:01:20 +0200

> In commit 5fa12739a53d ("net: ipv4: listify ip_rcv_finish") calling
> dst_input(skb) was split-out.  The ip_sublist_rcv_finish() just calls
> dst_input(skb) in a loop.
> 
> The problem is that ip_sublist_rcv_finish() forgot to remove the SKB
> from the list before invoking dst_input().  Further more we need to
> clear skb->next as other parts of the network stack use another kind
> of SKB lists for xmit_more (see dev_hard_start_xmit).
> 
> A crash occurs if e.g. dst_input() invoke ip_forward(), which calls
> dst_output()/ip_output() that eventually calls __dev_queue_xmit() +
> sch_direct_xmit(), and a crash occurs in validate_xmit_skb_list().
> 
> This patch only fixes the crash, but there is a huge potential for
> a performance boost if we can pass an SKB-list through to ip_forward.
> 
> Fixes: 5fa12739a53d ("net: ipv4: listify ip_rcv_finish")
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> ---
> Only driver sfc actually uses this, but I don't have this NIC, so I
> tested this on mlx5, with my own changes to make it use netif_receive_skb_list(),
> but I'm not ready to upstream the mlx5 driver change yet.

Applied, thanks Jesper.

This whole:

	list_del();
	skb->next = NULL;

business is exactly the kind of dragons I was worried about when starting
to use list_head with SKBs.

There is a similar fix wrt. the GRO stuff that I'm about to apply as well.

It definitely is better if we don't have to forcefully hand off NULL
->next next pointers like this in the long term.

      parent reply	other threads:[~2018-07-12 23:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11 15:01 [net-next PATCH] net: ipv4: fix listify ip_rcv_finish in case of forwarding Jesper Dangaard Brouer
2018-07-11 15:41 ` Edward Cree
2018-07-11 20:15   ` Jesper Dangaard Brouer
2018-07-11 19:05 ` Saeed Mahameed
2018-07-11 20:06   ` Jesper Dangaard Brouer
2018-07-12 20:10     ` Or Gerlitz
2018-07-13 11:08       ` Jesper Dangaard Brouer
2018-07-13 14:19       ` Edward Cree
2018-07-13 16:04         ` Jesper Dangaard Brouer
2018-07-13 18:14         ` Eric Dumazet
2018-07-30 14:38     ` Or Gerlitz
2018-07-12 23:41 ` David Miller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180712.164142.1404268131433458085.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=brouer@redhat.com \
    --cc=ecree@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).