From: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jarek Poplawski <jarkao2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "David Brownell"
<david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>,
"Michał Nazarewicz"
<m.nazarewicz-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
"Neil Jones" <neiljay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: rndis gadget: Inconsistent locking
Date: Wed, 12 Jan 2011 14:07:12 +0100 [thread overview]
Message-ID: <1294837632.3981.18.camel@edumazet-laptop> (raw)
In-Reply-To: <20110112122811.GA9513-8HppEYmqbBCE+EvaaNYduQ@public.gmane.org>
Le mercredi 12 janvier 2011 à 12:28 +0000, Jarek Poplawski a écrit :
> On 2011-01-10 13:14, David Brownell wrote:
> >
> >
> >> I have just retested Michals patch but I have found another
> >> lockdep failure.
> >>
> >> It looks like rndis_msg_parser() can call dev_get_stats> too:
> >
> > Can someone provide a fully working patch then?
> > Or maybe just revert the one that caused all the
> > breakage??
> >
> > Rememeber that this driver was working fine for
> > years before netdev changes added multiple bugs
> > because (at least) they didn't update all callers.
>
> Maybe I miss something, but if it's like Michal described something
> like this should be enough (not tested nor compiled).
>
> Jarek P.
> ---
>
> drivers/usb/gadget/f_phonet.c | 6 ++++++
> drivers/usb/gadget/u_ether.c | 6 ++++++
> 2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
> index 3c6e1a0..bef4622 100644
> --- a/drivers/usb/gadget/f_phonet.c
> +++ b/drivers/usb/gadget/f_phonet.c
> @@ -207,6 +207,11 @@ static int pn_net_close(struct net_device *dev)
> return 0;
> }
>
> +static struct net_device_stats *pn_net_stats(struct net_device *dev)
> +{
> + return &dev->stats;
> +}
> +
> static void pn_tx_complete(struct usb_ep *ep, struct usb_request *req)
> {
> struct f_phonet *fp = ep->driver_data;
> @@ -279,6 +284,7 @@ static int pn_net_mtu(struct net_device *dev, int new_mtu)
> static const struct net_device_ops pn_netdev_ops = {
> .ndo_open = pn_net_open,
> .ndo_stop = pn_net_close,
> + .ndo_get_stats = pn_net_stats,
> .ndo_start_xmit = pn_net_xmit,
> .ndo_change_mtu = pn_net_mtu,
> };
> diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
> index 1eda968..f21520f 100644
> --- a/drivers/usb/gadget/u_ether.c
> +++ b/drivers/usb/gadget/u_ether.c
> @@ -702,6 +702,11 @@ static int eth_stop(struct net_device *net)
> return 0;
> }
>
> +static struct net_device_stats *eth_get_stats(struct net_device *net)
> +{
> + return &net->stats;
> +}
> +
> /*-------------------------------------------------------------------------*/
>
> /* initial value, changed by "ifconfig usb0 hw ether xx:xx:xx:xx:xx:xx" */
> @@ -740,6 +745,7 @@ static struct eth_dev *the_dev;
> static const struct net_device_ops eth_netdev_ops = {
> .ndo_open = eth_open,
> .ndo_stop = eth_stop,
> + .ndo_get_stats = eth_get_stats,
> .ndo_start_xmit = eth_start_xmit,
> .ndo_change_mtu = ueth_change_mtu,
> .ndo_set_mac_address = eth_mac_addr,
> --
Hmm...
So all net devices in gen_ndis_query_resp() should have a
ndo_get_stats() or ndo_get_stats64() method, not allowed to use
spin_lock_bh() / spin_unlock_bh()
If yes, we should add big fat comments to pn_net_stats()/eth_get_stats() so that nobody
tries to revert your patch ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-01-12 13:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-08 15:03 rndis gadget: Inconsistent locking Neil Jones
2010-12-08 15:11 ` Neil Jones
2010-12-08 17:15 ` Michał Nazarewicz
2010-12-09 17:00 ` Neil Jones
[not found] ` <AANLkTinE1srqkpib0+8Q63XjnhRYEWaaDsX70tc_OeUm-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-10 10:01 ` Michał Nazarewicz
[not found] ` <AANLkTi==UqNNzokLcLWDpjM0cqM6aXjppsi4p6ogMAqX-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-26 23:49 ` David Brownell
2011-01-07 9:30 ` Neil Jones
2011-01-07 11:20 ` David Brownell
2011-01-10 11:32 ` Neil Jones
2011-01-10 12:14 ` David Brownell
2011-01-12 12:28 ` Jarek Poplawski
[not found] ` <20110112122811.GA9513-8HppEYmqbBCE+EvaaNYduQ@public.gmane.org>
2011-01-12 13:07 ` Eric Dumazet [this message]
2011-01-12 13:23 ` Jarek Poplawski
2011-01-12 13:32 ` Eric Dumazet
2011-01-12 13:41 ` Jarek Poplawski
2011-01-12 13:52 ` Eric Dumazet
2011-01-12 15:02 ` [PATCH] net: remove dev_txq_stats_fold() Eric Dumazet
2011-01-12 21:05 ` Jarek Poplawski
[not found] ` <20110112210518.GA2152-qLhEM4ewh5CNj9Bq2fkWzw@public.gmane.org>
2011-01-12 21:18 ` Jarek Poplawski
2011-01-12 22:13 ` Eric Dumazet
2011-01-14 5:45 ` 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=1294837632.3981.18.camel@edumazet-laptop \
--to=eric.dumazet-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org \
--cc=jarkao2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=m.nazarewicz-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=neiljay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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