netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Nikolay Aleksandrov <nikolay@redhat.com>
Cc: netdev@vger.kernel.org, andy@greyhouse.net, fubar@us.ibm.com,
	davem@davemloft.net
Subject: Re: [PATCH 4/4] bonding: fix multiple 3ad mode sysfs race conditions
Date: Wed, 15 May 2013 17:53:41 +0400	[thread overview]
Message-ID: <51939365.4020905@cogentembedded.com> (raw)
In-Reply-To: <1368621162-6807-5-git-send-email-nikolay@redhat.com>

Hello.

On 15-05-2013 16:32, Nikolay Aleksandrov wrote:

> When bond_3ad_get_active_agg_info() is used in all show_ad_ functions
> it is not protected against slave manipulation and since it walks over
> the slaves and uses them, this can easily result in NULL pointer
> dereference or use of freed memory.

> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
> ---
>   drivers/net/bonding/bond_sysfs.c | 21 ++++++++++++++++-----
>   1 file changed, 16 insertions(+), 5 deletions(-)

> diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
> index 77ea237..81ef36a 100644
> --- a/drivers/net/bonding/bond_sysfs.c
> +++ b/drivers/net/bonding/bond_sysfs.c
[...]
> @@ -1333,7 +1344,7 @@ static ssize_t bonding_show_ad_aggregator(struct device *d,
>   	if (bond->params.mode == BOND_MODE_8023AD) {
>   		struct ad_info ad_info;
>   		count = sprintf(buf, "%d\n",
> -				(bond_3ad_get_active_agg_info(bond, &ad_info))
> +				(get_active_agg_info(bond, &ad_info))
>   				?  0 : ad_info.aggregator_id);
>   	}
>
> @@ -1355,7 +1366,7 @@ static ssize_t bonding_show_ad_num_ports(struct device *d,
>   	if (bond->params.mode == BOND_MODE_8023AD) {
>   		struct ad_info ad_info;
>   		count = sprintf(buf, "%d\n",
> -				(bond_3ad_get_active_agg_info(bond, &ad_info))
> +				(get_active_agg_info(bond, &ad_info))
>   				?  0 : ad_info.ports);
>   	}
>
> @@ -1377,7 +1388,7 @@ static ssize_t bonding_show_ad_actor_key(struct device *d,
>   	if (bond->params.mode == BOND_MODE_8023AD) {
>   		struct ad_info ad_info;
>   		count = sprintf(buf, "%d\n",
> -				(bond_3ad_get_active_agg_info(bond, &ad_info))
> +				(get_active_agg_info(bond, &ad_info))
>   				?  0 : ad_info.actor_key);
>   	}
>
> @@ -1399,7 +1410,7 @@ static ssize_t bonding_show_ad_partner_key(struct device *d,
>   	if (bond->params.mode == BOND_MODE_8023AD) {
>   		struct ad_info ad_info;
>   		count = sprintf(buf, "%d\n",
> -				(bond_3ad_get_active_agg_info(bond, &ad_info))
> +				(get_active_agg_info(bond, &ad_info))
>   				?  0 : ad_info.partner_key);
>   	}

    Perhaps it's time to get rid of the useless parens around function 
call in ?: operator?

WBR, Sergei

  reply	other threads:[~2013-05-15 13:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15 12:32 [PATCH 0/4] bonding: race and inconsistency fixes Nikolay Aleksandrov
2013-05-15 12:32 ` [PATCH 1/4] bonding: fix set mode race conditions Nikolay Aleksandrov
2013-05-15 12:32 ` [PATCH 2/4] bonding: replace %x with %pI4 for IPv4 addresses Nikolay Aleksandrov
2013-05-15 12:32 ` [PATCH 3/4] bonding: arp_ip_count and arp_targets can be wrong Nikolay Aleksandrov
2013-05-17 18:00   ` Jay Vosburgh
2013-05-15 12:32 ` [PATCH 4/4] bonding: fix multiple 3ad mode sysfs race conditions Nikolay Aleksandrov
2013-05-15 13:53   ` Sergei Shtylyov [this message]
2013-05-15 13:54     ` Nikolay Aleksandrov
2013-05-17 16:59   ` Jay Vosburgh
2013-05-18  2:45     ` Nikolay Aleksandrov
2013-05-17  8:30 ` [PATCH 0/4] bonding: race and inconsistency fixes David Miller

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=51939365.4020905@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@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 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).