Bug 49911 - Shall use “!C_CLOCAL” rather than “C_CLOCAL” in function moxa_new_dcdstate()?
Summary: Shall use “!C_CLOCAL” rather than “C_CLOCAL” in function moxa_new_dcdstate()?
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Serial (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Alan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-01 09:29 UTC by RUC_Soft_Sec
Modified: 2012-12-22 09:23 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.39
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description RUC_Soft_Sec 2012-11-01 09:29:40 UTC
I am not very sure whether this is a real bug.
In function moxa_new_dcdstate() (in file drivers/tty/moxa.c), function tty_hangup() may be called only when “C_CLOCAL(tty)” is true (at line 1363). But in many other places, function tty_hangup() is called only when “!C_CLOCAL(tty)” is true (e.g. codes of function rfcomm_dev_modem_status in file net/bluetooth/rfcomm/tty.c).
The related codes are as following.
moxa_new_dcdstate @@ drivers/tty/moxa.c:1362
1362                tty = tty_port_tty_get(&p->port);
1363                if (tty && C_CLOCAL(tty) && !dcd)
1364                        tty_hangup(tty);
1365                tty_kref_put(tty);

rfcomm_dev_modem_status @@ net/bluetooth/rfcomm/tty.c:625
625        if ((dev->modem_status & TIOCM_CD) && !(v24_sig & RFCOMM_V24_DV)) {
 626                if (dev->tty && !C_CLOCAL(dev->tty))
 627                        tty_hangup(dev->tty);
 628        }

Thanks

RUC_Soft_Sec
Comment 1 Alan 2012-11-01 14:25:02 UTC
Well spotted.. thats been lurking forever 8)

Will get it fixed although I'm not sure anyone has moxa hardware these days!
Comment 2 Florian Mickler 2012-12-22 09:23:02 UTC
A patch referencing this bug report has been merged in Linux v3.8-rc1:

commit 4bd82136cdf04f3a8d50e20c1b76da750f75f2db
Author: Alan Cox <alan@linux.intel.com>
Date:   Thu Nov 1 16:43:49 2012 +0000

    moxa: dcd handling of CLOCAL is backwards

Note You need to log in before you can comment on or make changes to this bug.