NetBSD Problem Report #18849

Received: (qmail 3809 invoked by uid 605); 29 Oct 2002 08:39:08 -0000
Message-Id: <200210290839.g9T8d1L01780@loop.home>
Date: Tue, 29 Oct 2002 01:39:01 -0700 (MST)
From: swp@alumni.rice.edu
Sender: gnats-bugs-owner@netbsd.org
Reply-To: swp@alumni.rice.edu
To: gnats-bugs@gnats.netbsd.org
Subject: open of dcm modem port sometimes hangs
X-Send-Pr-Version: 3.95

>Number:         18849
>Category:       port-hp300
>Synopsis:       open of dcm modem port sometimes hangs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-hp300-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 29 08:40:00 +0000 2002
>Closed-Date:    Sun May 04 02:10:42 +0000 2003
>Last-Modified:  Sun May 04 02:11:00 +0000 2003
>Originator:     Steve Peurifoy
>Release:        NetBSD 1.5.2
>Organization:
>Environment:
System: NetBSD loop.home 1.5.2 NetBSD 1.5.2 (loop) #2: Fri Oct 25 23:49:35 MDT 2002 root@loop.home:/usr/obj/sys/arch/hp300/compile/loop hp300


>Description:
	Occasionally a blocking open of dcm port 0 will hang in ttyopen()
	waiting for carrier detect to be asserted when it's already
	present.
>How-To-Repeat:
	I've encountered this at random times wth a couple of different
	modems.
>Fix:
	The problem is that dcmmint() will return before updating the
	value of sc->sc_mcndlast if the device is not open.  If carrier
	detect drops after the device is closed, sc->sc_mcndlast will
	no longer correctly represent the "previous" state of the
	signals when the next transition of carrier detect occurs.
	A subsequent blocking open will wait forever for an event
	which has in fact taken place.

Index: dcm.c
===================================================================
RCS file: /cvs/src/sys/arch/hp300/dev/dcm.c,v
retrieving revision 1.2
diff -c -r1.2 dcm.c
*** dcm.c	2002/10/21 08:36:57	1.2
--- dcm.c	2002/10/26 05:46:09
***************
*** 908,917 ****
  	struct tty *tp;
  	struct dcmdevice *dcm = sc->sc_dcm;

- 	tp = sc->sc_tty[port];
- 	if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
- 		return;
- 
  #ifdef DEBUG
  	if (dcmdebug & DDB_MODEM)
  		printf("%s port %d: dcmmint: mcnd %x mcndlast %x\n",
--- 908,913 ----
***************
*** 919,924 ****
--- 915,924 ----
  #endif
  	delta = mcnd ^ sc->sc_mcndlast[port];
  	sc->sc_mcndlast[port] = mcnd;
+ 	tp = sc->sc_tty[port];
+ 	if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
+ 		return;
+ 
  	if ((delta & MI_CTS) && (tp->t_state & TS_ISOPEN) &&
  	    (tp->t_cflag & CCTS_OFLOW)) {
  		if (mcnd & MI_CTS) {

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: gmcgarry 
State-Changed-When: Sun May 4 02:10:24 UTC 2003 
State-Changed-Why:  
patch applied. 

From: Gregory McGarry <gmcgarry@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: pr/18849 CVS commit: src/sys/arch/hp300/dev
Date: Sun,  4 May 2003 02:10:09 +0000 (UTC)

 Module Name:	src
 Committed By:	gmcgarry
 Date:		Sun May  4 02:10:08 UTC 2003

 Modified Files:
 	src/sys/arch/hp300/dev: dcm.c

 Log Message:
 Fix from Steve Peurifoy in PR#18849:

 "Occasionally a blocking open of dcm port 0 will hang in ttyopen()
 waiting for carrier detect to be asserted when it's already
 present.

 The problem is that dcmmint() will return before updating the
 value of sc->sc_mcndlast if the device is not open.  If carrier
 detect drops after the device is closed, sc->sc_mcndlast will
 no longer correctly represent the "previous" state of the
 signals when the next transition of carrier detect occurs.
 A subsequent blocking open will wait forever for an event
 which has in fact taken place."


 To generate a diff of this commit:
 cvs rdiff -r1.57 -r1.58 src/sys/arch/hp300/dev/dcm.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.