netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Laszlo Attila Toth <panther@balabit.hu>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: [PATCHv6 1/3] rtnetlink: setlink changes are unprotected; with single notification
Date: Tue, 27 Nov 2007 14:07:28 +0100	[thread overview]
Message-ID: <474C1690.3010405@trash.net> (raw)
In-Reply-To: <1195564470928-git-send-email-panther@balabit.hu>

Laszlo Attila Toth wrote:
> In do_setlink the device changes don't need to be protected. Notification
> is sent at the end of the function once if any modification occured
> and once if an address has been changed.
> 
> Signed-off-by: Laszlo Attila Toth <panther@balabit.hu>
> ---
>  net/core/rtnetlink.c |   32 ++++++++++++++++++++------------
>  1 files changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 4a07e83..20cb67e 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -542,7 +542,7 @@ int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id,
>  
>  EXPORT_SYMBOL_GPL(rtnl_put_cacheinfo);
>  
> -static void set_operstate(struct net_device *dev, unsigned char transition)
> +static int set_operstate(struct net_device *dev, unsigned char transition)
>  {
>  	unsigned char operstate = dev->operstate;
>  
> @@ -562,11 +562,10 @@ static void set_operstate(struct net_device *dev, unsigned char transition)
>  	}
>  
>  	if (dev->operstate != operstate) {
> -		write_lock_bh(&dev_base_lock);
>  		dev->operstate = operstate;
> -		write_unlock_bh(&dev_base_lock);
> -		netdev_state_change(dev);
> -	}
> +		return 1;
> +	} else
> +		return 0;


The locking changes belong in a seperate patch with an explanation.

>  
> -	if (tb[IFLA_OPERSTATE])
> -		set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
> +	if (tb[IFLA_OPERSTATE]) {
> +		modified |= set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
> +	}

Please don't add braces here.

The rest looks fine.

  parent reply	other threads:[~2007-11-27 13:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-20 13:14 [PATCHv6 0/3] Interface group patches Laszlo Attila Toth
2007-11-20 13:14 ` [PATCHv6 1/3] rtnetlink: setlink changes are unprotected; with single notification Laszlo Attila Toth
2007-11-20 13:14   ` [PATCHv6 2/3] Interface group: core (netlink) part Laszlo Attila Toth
2007-11-20 13:14     ` [PATCHv6 3/3] Netfilter Interface group match Laszlo Attila Toth
2007-11-20 13:14       ` [PATCHv6 iptables]Interface " Laszlo Attila Toth
2007-11-20 13:14         ` [PATCHv6 iproute 1/2] Added IFLA_NET_NS_PID as in kernel v2.6.24-rc1 Laszlo Attila Toth
2007-11-20 13:14           ` [PATCHv6 iproute 2/2] Interface group as new ip link option Laszlo Attila Toth
2007-11-23 13:25             ` Lutz Jaenicke
2007-11-23 13:39         ` [PATCHv6 iptables]Interface group match Lutz Jaenicke
2007-11-29 12:50           ` Laszlo Attila Toth
2007-11-29 16:16             ` Patrick McHardy
2007-11-29 16:23               ` Laszlo Attila Toth
2007-11-29 16:27                 ` Patrick McHardy
2007-11-29 17:14                   ` Jan Engelhardt
2007-11-29 17:15                     ` Patrick McHardy
2007-11-27 13:10       ` [PATCHv6 3/3] Netfilter Interface " Patrick McHardy
2007-11-23 13:18     ` [PATCHv6 2/3] Interface group: core (netlink) part Lutz Jaenicke
2007-11-27 13:07     ` Patrick McHardy
2007-11-27 13:07   ` Patrick McHardy [this message]
2007-11-20 13:26 ` [PATCHv6 0/3] Interface group patches Jan Engelhardt
2007-11-20 13:52   ` Laszlo Attila Toth
2007-11-20 21:42     ` David Miller
2007-11-21  0:25       ` Patrick McHardy
2007-11-21  1:17         ` David Miller
2007-11-22  9:05           ` Laszlo Attila Toth
2007-11-21 15:56         ` Balazs Scheidler

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=474C1690.3010405@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=panther@balabit.hu \
    /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).