From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Ben Greear <greearb@candelatech.com>
Cc: Patrick McHardy <kaber@trash.net>,
"netdev@oss.sgi.com" <netdev@oss.sgi.com>
Subject: Re: Leaked net-device reference in eql.c
Date: Sat, 27 Aug 2005 06:39:14 -0300 [thread overview]
Message-ID: <39e6f6c705082702396591573d@mail.gmail.com> (raw)
In-Reply-To: <39e6f6c705082702372dbc902d@mail.gmail.com>
On 8/27/05, Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
> On 8/27/05, Ben Greear <greearb@candelatech.com> wrote:
> > Patrick McHardy wrote:
> > > Ben Greear wrote:
> > >
> > >> I think the eql_s_slave_cfg method in eql.c leaks
> > >> the reference to slave_dev. Am I missing something?
> > >
> > >
> > > No, it should also put the device, as in eql_g_slave_cfg.
> >
> > Ok, I'm making a patch...will add this to it.
> >
> > How about this one. It seems like it does a dev_put when it shouldn't
> > (if some of the if's fail, the dev_get never happened):
> >
> > net/sched/sch_generic.c
> >
> > static void dev_watchdog(unsigned long arg)
> > {
> > struct net_device *dev = (struct net_device *)arg;
> >
> > spin_lock(&dev->xmit_lock);
> > if (dev->qdisc != &noop_qdisc) {
> > if (netif_device_present(dev) &&
> > netif_running(dev) &&
> > netif_carrier_ok(dev)) {
> > if (netif_queue_stopped(dev) &&
> > (jiffies - dev->trans_start) > dev->watchdog_timeo) {
> > printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", dev->name);
> > dev->tx_timeout(dev);
> > }
> > if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo))
> > dev_hold(dev);
> > }
> > }
> > spin_unlock(&dev->xmit_lock);
> >
> > dev_put(dev);
> > }
>
> Doesn't look like its a problem, its the classical case where when you
> associate some data structure to a timer you grab a refcount, when the
> timer expires you drop the refcount, and as the code above shows when
> mod_timer is succesfully called it grabs a reference, so the reference
> being dropped above is from the previous timer firing, now its just a matter
> if looking for the first mod_timer, that must be at some other place in
> sched_generic.c, lemme see...
Yup, look at __netdev_watchdog_up :-)
- Arnaldo
prev parent reply other threads:[~2005-08-27 9:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-27 0:08 Leaked net-device reference in eql.c Ben Greear
2005-08-27 3:38 ` Patrick McHardy
2005-08-27 6:24 ` Ben Greear
2005-08-27 9:37 ` Arnaldo Carvalho de Melo
2005-08-27 9:39 ` Arnaldo Carvalho de Melo [this message]
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=39e6f6c705082702396591573d@mail.gmail.com \
--to=arnaldo.melo@gmail.com \
--cc=greearb@candelatech.com \
--cc=kaber@trash.net \
--cc=netdev@oss.sgi.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.