Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hayes Wang <hayeswang@realtek.com>, netdev@vger.kernel.org
Cc: nic_swsd@realtek.com, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH net-next v2 4/5] r8152: support skb_add_rx_frag
Date: Fri, 16 Aug 2019 08:42:35 +0200
Message-ID: <614e322b-fcca-fd4f-f338-76a7fbf84ad1@gmail.com> (raw)
In-Reply-To: <1394712342-15778-299-albertk@realtek.com>



On 8/13/19 5:42 AM, Hayes Wang wrote:
> Use skb_add_rx_frag() to reduce the memory copy for rx data.
> 
> Use a new list of rx_used to store the rx buffer which couldn't be
> reused yet.
> 
> Besides, the total number of rx buffer may be increased or decreased
> dynamically. And it is limited by RTL8152_MAX_RX_AGG.
> 
> Signed-off-by: Hayes Wang <hayeswang@realtek.com>
>

...

>  			skb->protocol = eth_type_trans(skb, netdev);
>  			rtl_rx_vlan_tag(rx_desc, skb);
>  			if (work_done < budget) {
>  				napi_gro_receive(napi, skb);
>  				work_done++;
>  				stats->rx_packets++;
> -				stats->rx_bytes += pkt_len;
> +				stats->rx_bytes += skb->len;

use-after-free. skb is no longer in your hands after napi_gro_receive()


  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1394712342-15778-289-Taiwan-albertk@realtek.com>
2019-08-13  3:42 ` [PATCH net-next v2 0/5] r8152: RX improve Hayes Wang
2019-08-13  3:42   ` [PATCH net-next v2 1/5] r8152: separate the rx buffer size Hayes Wang
2019-08-13  3:42   ` [PATCH net-next v2 2/5] r8152: replace array with linking list for rx information Hayes Wang
2019-08-13  3:42   ` [PATCH net-next v2 3/5] r8152: use alloc_pages for rx buffer Hayes Wang
2019-08-13  3:42   ` [PATCH net-next v2 4/5] r8152: support skb_add_rx_frag Hayes Wang
2019-08-16  6:42     ` Eric Dumazet [this message]
2019-08-13  3:42   ` [PATCH net-next v2 5/5] r8152: change rx_copybreak and rx_pending through ethtool Hayes Wang
2019-08-14  1:15   ` [PATCH net-next v2 0/5] r8152: RX improve Jakub Kicinski

Reply instructions:

You may reply publically 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=614e322b-fcca-fd4f-f338-76a7fbf84ad1@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=hayeswang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    /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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org linux-usb@archiver.kernel.org
	public-inbox-index linux-usb


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/ public-inbox