From: Greg KH <greg@kroah.com>
To: Chris Wright <chrisw@osdl.org>
Cc: Hanna Linder <hannal@us.ibm.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6] Patch to hook up PPP to simple class sysfs support
Date: Wed, 10 Mar 2004 17:29:11 -0800 [thread overview]
Message-ID: <20040311012911.GA13045@kroah.com> (raw)
In-Reply-To: <20040303195539.S22989@build.pdx.osdl.net>
On Wed, Mar 03, 2004 at 07:55:39PM -0800, Chris Wright wrote:
> * Hanna Linder (hannal@us.ibm.com) wrote:
> > + ppp_class = class_simple_create(THIS_MODULE, "ppp");
> > + class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp");
>
> What happens if that class_simple_create() fails? Actually,
> class_simple_device_add could fail too, but doesn't seem anybody is
> checking for that.
>
> > err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
> > S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
> > - if (err)
> > + if (err) {
> > unregister_chrdev(PPP_MAJOR, "ppp");
> > + class_simple_device_remove(MKDEV(PPP_MAJOR,0));
> > + }
>
> need to destroy the class on error path to avoid leak.
>
> > @@ -2540,6 +2547,7 @@ static void __exit ppp_cleanup(void)
> > if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
> > printk(KERN_ERR "PPP: failed to unregister PPP device\n");
> > devfs_remove("ppp");
> > + class_simple_device_remove(MKDEV(PPP_MAJOR, 0));
>
> ditto. this will leak and would cause oops on reload of module.
>
> something like below.
Applied, thanks.
greg k-h
next prev parent reply other threads:[~2004-03-11 1:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-03 23:28 Another UDEV question reg
2004-03-03 23:43 ` Greg KH
2004-03-04 1:03 ` [PATCH 2.6] Patch to hook up PPP to simple class sysfs support Hanna Linder
2004-03-04 3:55 ` Chris Wright
2004-03-05 2:05 ` Hanna Linder
2004-03-11 1:29 ` Greg KH [this message]
2004-03-04 5:16 ` Jeff Garzik
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=20040311012911.GA13045@kroah.com \
--to=greg@kroah.com \
--cc=chrisw@osdl.org \
--cc=hannal@us.ibm.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 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.