All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Taehee Yoo <ap420073@gmail.com>
Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH net 1/8] amt: use workqueue for gateway side message handling
Date: Wed, 13 Jul 2022 20:55:09 -0700	[thread overview]
Message-ID: <20220713205509.2a79563a@kernel.org> (raw)
In-Reply-To: <20220712105714.12282-2-ap420073@gmail.com>

On Tue, 12 Jul 2022 10:57:07 +0000 Taehee Yoo wrote:
> @@ -2392,12 +2429,14 @@ static bool amt_membership_query_handler(struct amt_dev *amt,
>  	skb->pkt_type = PACKET_MULTICAST;
>  	skb->ip_summed = CHECKSUM_NONE;
>  	len = skb->len;
> +	rcu_read_lock_bh();
>  	if (__netif_rx(skb) == NET_RX_SUCCESS) {
>  		amt_update_gw_status(amt, AMT_STATUS_RECEIVED_QUERY, true);
>  		dev_sw_netstats_rx_add(amt->dev, len);
>  	} else {
>  		amt->dev->stats.rx_dropped++;
>  	}
> +	rcu_read_unlock_bh();
>  
>  	return false;
>  }

The RCU lock addition looks potentially unrelated?

> @@ -2892,10 +3007,21 @@ static int amt_dev_stop(struct net_device *dev)
>  	struct amt_dev *amt = netdev_priv(dev);
>  	struct amt_tunnel_list *tunnel, *tmp;
>  	struct socket *sock;
> +	struct sk_buff *skb;
> +	int i;
>  
>  	cancel_delayed_work_sync(&amt->req_wq);
>  	cancel_delayed_work_sync(&amt->discovery_wq);
>  	cancel_delayed_work_sync(&amt->secret_wq);
> +	cancel_work_sync(&amt->event_wq);

Are you sure the work will not get scheduled again?
What has stopped packet Rx at this point?

> +	for (i = 0; i < AMT_MAX_EVENTS; i++) {
> +		skb = amt->events[i].skb;
> +		if (skb)
> +			kfree_skb(skb);
> +		amt->events[i].event = AMT_EVENT_NONE;
> +		amt->events[i].skb = NULL;
> +	}
> 
>  	/* shutdown */
>  	sock = rtnl_dereference(amt->sock);
> @@ -3051,6 +3177,8 @@ static int amt_newlink(struct net *net, struct net_device *dev,
>  		amt->max_tunnels = AMT_MAX_TUNNELS;
>  
>  	spin_lock_init(&amt->lock);
> +	amt->event_idx = 0;
> +	amt->nr_events = 0;

no need to init member of netdev_priv() to 0, it's zalloc'ed

>  	amt->max_groups = AMT_MAX_GROUP;
>  	amt->max_sources = AMT_MAX_SOURCE;
>  	amt->hash_buckets = AMT_HSIZE;

  reply	other threads:[~2022-07-14  3:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 10:57 [PATCH net 0/8] amt: fix validation and synchronization bugs Taehee Yoo
2022-07-12 10:57 ` [PATCH net 1/8] amt: use workqueue for gateway side message handling Taehee Yoo
2022-07-14  3:55   ` Jakub Kicinski [this message]
2022-07-15 12:34     ` Taehee Yoo
2022-07-14  8:09   ` Paolo Abeni
2022-07-15 12:51     ` Taehee Yoo
2022-07-12 10:57 ` [PATCH net 2/8] amt: remove unnecessary locks Taehee Yoo
2022-07-12 10:57 ` [PATCH net 3/8] amt: use READ_ONCE() in amt module Taehee Yoo
2022-07-12 10:57 ` [PATCH net 4/8] amt: add missing regeneration nonce logic in request logic Taehee Yoo
2022-07-12 10:57 ` [PATCH net 5/8] amt: drop unexpected advertisement message Taehee Yoo
2022-07-12 10:57 ` [PATCH net 6/8] amt: drop unexpected query message Taehee Yoo
2022-07-12 10:57 ` [PATCH net 7/8] amt: drop unexpected multicast data Taehee Yoo
2022-07-12 10:57 ` [PATCH net 8/8] amt: do not use amt->nr_tunnels outside of lock Taehee Yoo

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=20220713205509.2a79563a@kernel.org \
    --to=kuba@kernel.org \
    --cc=ap420073@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.