From: Tilman Schmidt <tilman@imap.cc>
To: Jiri Slaby <jslaby@suse.cz>
Cc: gregkh@linuxfoundation.org, alan@linux.intel.com,
linux-kernel@vger.kernel.org, jirislaby@gmail.com
Subject: Re: [PATCH 9/9] TTY: call tty_port_destroy in the rest of drivers
Date: Sun, 18 Nov 2012 14:39:45 +0100 [thread overview]
Message-ID: <50A8E521.10509@imap.cc> (raw)
In-Reply-To: <1352969396-23760-10-git-send-email-jslaby@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 2433 bytes --]
Hi Jiri,
Two remarks wrt the Gigaset driver.
Am 15.11.2012 09:49, schrieb Jiri Slaby:
> diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
> index 30a6b17..bc9d89a 100644
> --- a/drivers/isdn/gigaset/common.c
> +++ b/drivers/isdn/gigaset/common.c
> @@ -518,6 +518,7 @@ f_bcs: gig_dbg(DEBUG_INIT, "freeing bcs[]");
> kfree(cs->bcs);
> f_cs: gig_dbg(DEBUG_INIT, "freeing cs");
> mutex_unlock(&cs->mutex);
> + tty_port_destroy(&cs->port);
> free_cs(cs);
> }
> EXPORT_SYMBOL_GPL(gigaset_freecs);
It is not ok to call tty_port_destroy() unconditionally here.
gigaset_freecs() may be called from gigaset_initcs() before
the tty_port_init(&cs->port) call if a memory allocation fails.
This is best fixed by moving that call to case 1 of the preceding
switch statement because cs_init >= 1 covers exactly the cases
where the tty_port_init(&cs->port) call has already been passed.
> @@ -751,14 +752,14 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
> gig_dbg(DEBUG_INIT, "setting up iif");
> if (gigaset_isdn_regdev(cs, modulename) < 0) {
> pr_err("error registering ISDN device\n");
> - goto error;
> + goto error_port;
> }
>
> make_valid(cs, VALID_ID);
> ++cs->cs_init;
> gig_dbg(DEBUG_INIT, "setting up hw");
> if (cs->ops->initcshw(cs) < 0)
> - goto error;
> + goto error_port;
>
> ++cs->cs_init;
>
> @@ -773,7 +774,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
> gig_dbg(DEBUG_INIT, "setting up bcs[%d]", i);
> if (gigaset_initbcs(cs->bcs + i, cs, i) < 0) {
> pr_err("could not allocate channel %d data\n", i);
> - goto error;
> + goto error_port;
> }
> }
>
> @@ -786,7 +787,8 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
>
> gig_dbg(DEBUG_INIT, "cs initialized");
> return cs;
> -
> +error_port:
> + tty_port_destroy(&cs->port);
> error:
> gig_dbg(DEBUG_INIT, "failed");
> gigaset_freecs(cs);
You have already added a tty_port_destroy() call to gigaset_freecs(cs)
above. Adding another one here will lead to the port being destroyed
twice in this code path.
Thanks,
Tilman
--
Tilman Schmidt E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]
next prev parent reply other threads:[~2012-11-18 13:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-15 8:49 [PATCH 0/9] TTY: memory leaks patchset Jiri Slaby
2012-11-15 8:49 ` [PATCH 1/9] TTY: isicom, stop using port->tty Jiri Slaby
2012-11-15 8:49 ` [PATCH 2/9] TTY: pty, fix tty buffers leak Jiri Slaby
2012-11-15 8:49 ` [PATCH 3/9] ISDN: capi, use kref from tty_port Jiri Slaby
2012-11-15 8:49 ` [PATCH 4/9] MMC: sdio_uart, remove unused member from sdio_uart_port Jiri Slaby
2012-11-15 8:49 ` [PATCH 5/9] MMC: sdio, use kref from tty_port Jiri Slaby
2012-11-15 8:49 ` [PATCH 6/9] TTY: n_gsm, " Jiri Slaby
2012-11-15 8:49 ` [PATCH 7/9] TTY: introduce tty_port_destroy Jiri Slaby
2012-11-15 8:49 ` [PATCH 8/9] TTY: isicom, fix tty buffers memory leak Jiri Slaby
2012-11-15 8:49 ` [PATCH 9/9] TTY: call tty_port_destroy in the rest of drivers Jiri Slaby
2012-11-18 13:39 ` Tilman Schmidt [this message]
2012-11-27 16:52 ` Peter Hurley
2012-11-27 17:04 ` Greg Kroah-Hartman
2012-11-27 17:23 ` Peter Hurley
2012-11-28 2:37 ` [PATCH -next 0/3] staging/fwserial: teardown cleanup Peter Hurley
2012-11-28 2:37 ` [PATCH -next 1/3] staging/fwserial: Destruct embedded tty_port on teardown Peter Hurley
2012-11-28 2:37 ` [PATCH -next 2/3] staging/fwserial: Use WARN_ONCE when port table is corrupted Peter Hurley
2012-11-28 2:37 ` [PATCH -next 3/3] staging/fwserial: Remove superfluous free Peter Hurley
2012-11-15 10:42 ` [PATCH 0/9] TTY: memory leaks patchset Alan Cox
2012-11-16 1:21 ` Greg KH
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=50A8E521.10509@imap.cc \
--to=tilman@imap.cc \
--cc=alan@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@gmail.com \
--cc=jslaby@suse.cz \
--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.