diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-11-19 14:11:42 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-21 18:13:36 -0500 |
commit | 1862c14e107a5a21402852b0256b3c87bc1a5b00 (patch) | |
tree | 37028a856466161cde73025bd69e0c50be5a026d /drivers/isdn/gigaset | |
parent | a547e5e0d8b85ccc640756eb40b3dd6b33796cf8 (diff) |
TTY: isdn/gigaset destroy tty_port properly
Currently, the port may be destroyed twice or destroyed without being
initialized. Fix this by sticking the destroy call in the right place
as suggested by Tilman.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: Tilman Schmidt <tilman@imap.cc>
Cc: Hansjoerg Lipp <hjlipp@web.de>
Cc: gigaset307x-common@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/isdn/gigaset')
-rw-r--r-- | drivers/isdn/gigaset/common.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index bc9d89a8c4f6..6849a11a1b24 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
@@ -507,6 +507,7 @@ void gigaset_freecs(struct cardstate *cs) | |||
507 | gig_dbg(DEBUG_INIT, "clearing at_state"); | 507 | gig_dbg(DEBUG_INIT, "clearing at_state"); |
508 | clear_at_state(&cs->at_state); | 508 | clear_at_state(&cs->at_state); |
509 | dealloc_temp_at_states(cs); | 509 | dealloc_temp_at_states(cs); |
510 | tty_port_destroy(&cs->port); | ||
510 | 511 | ||
511 | /* fall through */ | 512 | /* fall through */ |
512 | case 0: /* error in basic setup */ | 513 | case 0: /* error in basic setup */ |
@@ -518,7 +519,6 @@ f_bcs: gig_dbg(DEBUG_INIT, "freeing bcs[]"); | |||
518 | kfree(cs->bcs); | 519 | kfree(cs->bcs); |
519 | f_cs: gig_dbg(DEBUG_INIT, "freeing cs"); | 520 | f_cs: gig_dbg(DEBUG_INIT, "freeing cs"); |
520 | mutex_unlock(&cs->mutex); | 521 | mutex_unlock(&cs->mutex); |
521 | tty_port_destroy(&cs->port); | ||
522 | free_cs(cs); | 522 | free_cs(cs); |
523 | } | 523 | } |
524 | EXPORT_SYMBOL_GPL(gigaset_freecs); | 524 | EXPORT_SYMBOL_GPL(gigaset_freecs); |
@@ -752,14 +752,14 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
752 | gig_dbg(DEBUG_INIT, "setting up iif"); | 752 | gig_dbg(DEBUG_INIT, "setting up iif"); |
753 | if (gigaset_isdn_regdev(cs, modulename) < 0) { | 753 | if (gigaset_isdn_regdev(cs, modulename) < 0) { |
754 | pr_err("error registering ISDN device\n"); | 754 | pr_err("error registering ISDN device\n"); |
755 | goto error_port; | 755 | goto error; |
756 | } | 756 | } |
757 | 757 | ||
758 | make_valid(cs, VALID_ID); | 758 | make_valid(cs, VALID_ID); |
759 | ++cs->cs_init; | 759 | ++cs->cs_init; |
760 | gig_dbg(DEBUG_INIT, "setting up hw"); | 760 | gig_dbg(DEBUG_INIT, "setting up hw"); |
761 | if (cs->ops->initcshw(cs) < 0) | 761 | if (cs->ops->initcshw(cs) < 0) |
762 | goto error_port; | 762 | goto error; |
763 | 763 | ||
764 | ++cs->cs_init; | 764 | ++cs->cs_init; |
765 | 765 | ||
@@ -774,7 +774,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
774 | gig_dbg(DEBUG_INIT, "setting up bcs[%d]", i); | 774 | gig_dbg(DEBUG_INIT, "setting up bcs[%d]", i); |
775 | if (gigaset_initbcs(cs->bcs + i, cs, i) < 0) { | 775 | if (gigaset_initbcs(cs->bcs + i, cs, i) < 0) { |
776 | pr_err("could not allocate channel %d data\n", i); | 776 | pr_err("could not allocate channel %d data\n", i); |
777 | goto error_port; | 777 | goto error; |
778 | } | 778 | } |
779 | } | 779 | } |
780 | 780 | ||
@@ -787,8 +787,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
787 | 787 | ||
788 | gig_dbg(DEBUG_INIT, "cs initialized"); | 788 | gig_dbg(DEBUG_INIT, "cs initialized"); |
789 | return cs; | 789 | return cs; |
790 | error_port: | 790 | |
791 | tty_port_destroy(&cs->port); | ||
792 | error: | 791 | error: |
793 | gig_dbg(DEBUG_INIT, "failed"); | 792 | gig_dbg(DEBUG_INIT, "failed"); |
794 | gigaset_freecs(cs); | 793 | gigaset_freecs(cs); |