From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jiri Pirko <jpirko@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
bhutchings@solarflare.com, shemminger@vyatta.com,
fubar@us.ibm.com, andy@greyhouse.net, tgraf@infradead.org,
ebiederm@xmission.com, mirqus@gmail.com, kaber@trash.net,
greearb@candelatech.com, jesse@nicira.com, fbl@redhat.com,
benjamin.poirier@gmail.com, jzupka@redhat.com
Subject: Re: [patch net-next V2] net: introduce ethernet teaming device
Date: Sat, 22 Oct 2011 18:51:22 +0200 [thread overview]
Message-ID: <1319302282.6180.60.camel@edumazet-laptop> (raw)
In-Reply-To: <20111022151346.GA2028@minipsycho.orion>
Le samedi 22 octobre 2011 à 17:13 +0200, Jiri Pirko a écrit :
> >> +
> >> +/************************
> >> + * Rx path frame handler
> >> + ************************/
> >> +
> >> +/* note: already called with rcu_read_lock */
> >> +static rx_handler_result_t team_handle_frame(struct sk_buff **pskb)
> >> +{
> >> + struct sk_buff *skb = *pskb;
> >> + struct team_port *port;
> >> + struct team *team;
> >> + rx_handler_result_t res = RX_HANDLER_ANOTHER;
> >> +
> >> + skb = skb_share_check(skb, GFP_ATOMIC);
> >> + if (!skb)
> >> + return RX_HANDLER_CONSUMED;
> >> +
> >> + *pskb = skb;
> >> +
> >> + port = team_port_get_rcu(skb->dev);
> >> + team = port->team;
> >> +
> >> + if (team->mode_ops.receive)
> >
> >Hmm, you need ACCESS_ONCE() here or rcu_dereference()
> >
> >See commit 4d97480b1806e883eb (bonding: use local function pointer of
> >bond->recv_probe in bond_handle_frame) for reference
>
> I do not think so. Because mode_ops.receive changes only from
> __team_change_mode() and this can be called only in case no ports are in
> team. And team_port_del() calls synchronize_rcu().
>
We are used to code following this template :
if (ops->handler)
ops->handler(arguments);
But this is valid only because ops points to constant memory.
In your case, we really see its not true, dont try to pretend its safe.
next prev parent reply other threads:[~2011-10-22 16:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-21 12:39 [patch net-next V2] net: introduce ethernet teaming device Jiri Pirko
2011-10-21 14:00 ` Benjamin Poirier
2011-10-21 14:18 ` Jiri Pirko
2011-10-21 14:43 ` Eric Dumazet
2011-10-21 15:02 ` Jiri Pirko
2011-10-21 15:31 ` Eric Dumazet
2011-10-22 15:13 ` Jiri Pirko
2011-10-22 16:51 ` Eric Dumazet [this message]
2011-10-23 8:25 ` Jiri Pirko
2011-10-23 8:43 ` Eric Dumazet
2011-10-23 8:52 ` Jiri Pirko
2011-10-23 10:45 ` Eric Dumazet
2011-10-23 12:51 ` Jiri Pirko
2011-10-23 14:37 ` Eric Dumazet
2011-10-23 15:50 ` Jiri Pirko
2011-10-21 18:27 ` Jay Vosburgh
2011-10-22 15:55 ` Jiri Pirko
2011-10-23 21:46 ` Or Gerlitz
2011-10-24 6:54 ` Jiri Pirko
2011-10-26 14:31 ` Or Gerlitz
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=1319302282.6180.60.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=andy@greyhouse.net \
--cc=benjamin.poirier@gmail.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=fbl@redhat.com \
--cc=fubar@us.ibm.com \
--cc=greearb@candelatech.com \
--cc=jesse@nicira.com \
--cc=jpirko@redhat.com \
--cc=jzupka@redhat.com \
--cc=kaber@trash.net \
--cc=mirqus@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=tgraf@infradead.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