From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: fabrizio.gennari@philips.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Re: dev_get_by_name without dev_put
Date: Wed, 4 Jul 2001 11:06:55 -0300 [thread overview]
Message-ID: <20010704110655.B897@conectiva.com.br> (raw)
In-Reply-To: <OF870A7F74.AB18863F-ONC1256A7F.004AB8A1@diamond.philips.com>
In-Reply-To: <OF870A7F74.AB18863F-ONC1256A7F.004AB8A1@diamond.philips.com>; from fabrizio.gennari@philips.com on Wed, Jul 04, 2001 at 03:49:46PM +0200
Em Wed, Jul 04, 2001 at 03:49:46PM +0200, fabrizio.gennari@philips.com escreveu:
> Every time dev_get_by_name is called, and it has returned a valid struct net_device*, dev_put should be called afterwards, because otherwise the machine hangs when the device is unregistered (since dev->refcnt > 1). However, it seems that some drivers do
> not call dev_put after dev_get_by_name: for example, drivers/net/pppoe.c at line 573 and net/core/dv.c at line 168. Am I wrong?
For pppoe (and one has to look at the set_item and see if delete_item is
needed).
- Arnaldo
--- linux-2.4.5-ac24/drivers/net/pppoe.c Tue Jul 3 18:45:41 2001
+++ linux-2.4.5-ac24.acme/drivers/net/pppoe.c Wed Jul 4 11:00:47 2001
@@ -567,17 +567,17 @@
if (!dev)
goto end;
+ po->pppoe_dev = dev;
+
if( ! (dev->flags & IFF_UP) )
- goto end;
+ goto err_put;
memcpy(&po->pppoe_pa,
&sp->sa_addr.pppoe,
sizeof(struct pppoe_addr));
error = set_item(po);
if (error < 0)
- goto end;
-
- po->pppoe_dev = dev;
+ goto err_put;
po->chan.hdrlen = (sizeof(struct pppoe_hdr) +
dev->hard_header_len);
@@ -586,6 +586,8 @@
po->chan.ops = &pppoe_chan_ops;
error = ppp_register_channel(&po->chan);
+ if (error)
+ goto err_put;
sk->state = PPPOX_CONNECTED;
}
@@ -595,6 +597,10 @@
end:
release_sock(sk);
return error;
+err_put:
+ dev_put(po->pppoe_dev);
+ po->pppoe_dev = NULL;
+ goto end;
}
- Arnaldo
next prev parent reply other threads:[~2001-07-04 14:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-04 13:49 dev_get_by_name without dev_put fabrizio.gennari
2001-07-04 14:06 ` Arnaldo Carvalho de Melo [this message]
2001-07-10 0:36 ` [PATCH] " David S. 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=20010704110655.B897@conectiva.com.br \
--to=acme@conectiva.com.br \
--cc=fabrizio.gennari@philips.com \
--cc=linux-kernel@vger.kernel.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