diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-09 17:01:47 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-09 17:05:01 -0800 |
commit | 52073e2edc29059a5142d4460c5edc8739981e03 (patch) | |
tree | a154719cf0a6deda918b2274aca24e45e13c622d | |
parent | cd5b383c3f6c5b7ffa19f8e6ebb7d6551898a98b (diff) |
sun_mouse: remove entry from vuidMouseList in DEVICE_CLOSE
Originally written by fei.feng@oracle.com to fix Oracle Bug 17429216:
"global vuidMouseList should not keep info for removed mouse device"
"During the testing for bug#17251473, I often see the mouse hang in X.
By debugging, I get that there seems something wrong in mouse_drv.so -
when a mouse is disconnected, the global vuidMouseList does not cleanup
the mouse's recorded info. So if a newly inserted mouse allocates a
input info pInfo which happens to have the same memory address as
previous pInfo, the driver would go wrong."
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/sun_mouse.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/sun_mouse.c b/src/sun_mouse.c index 3539ba7..20ec10d 100644 --- a/src/sun_mouse.c +++ b/src/sun_mouse.c @@ -742,8 +742,21 @@ vuidMouseProc(DeviceIntPtr pPointer, int what) } break; - case DEVICE_OFF: case DEVICE_CLOSE: + if (vuidMouseList == pVuidMse) + vuidMouseList = vuidMouseList->next; + else { + VuidMsePtr m = vuidMouseList; + + while ((m != NULL) && (m->next != pVuidMse)) { + m = m->next; + } + + if (m != NULL) + m->next = pVuidMse->next; + } + /* fallthrough */ + case DEVICE_OFF: if (pInfo->fd != -1) { if (pVuidMse->strmod) { SYSCALL(i = ioctl(pInfo->fd, I_POP, pVuidMse->strmod)); |