svn commit: r360185 - stable/11/sys/dev/evdev
Xin LI
delphij at FreeBSD.org
Wed Apr 22 05:14:53 UTC 2020
Author: delphij
Date: Wed Apr 22 05:14:52 2020
New Revision: 360185
URL: https://svnweb.freebsd.org/changeset/base/360185
Log:
MFC r360104: Use LIST_FOREACH_SAFE instead of LIST_FOREACH as we are
removing elements in the middle.
This fixes a panic when detaching USB mouse.
PR: 245732
Reviewed by: wulf
Modified:
stable/11/sys/dev/evdev/evdev.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/evdev/evdev.c
==============================================================================
--- stable/11/sys/dev/evdev/evdev.c Wed Apr 22 05:08:42 2020 (r360184)
+++ stable/11/sys/dev/evdev/evdev.c Wed Apr 22 05:14:52 2020 (r360185)
@@ -354,7 +354,7 @@ evdev_register_mtx(struct evdev_dev *evdev, struct mtx
int
evdev_unregister(struct evdev_dev *evdev)
{
- struct evdev_client *client;
+ struct evdev_client *client, *tmp;
int ret;
debugf(evdev, "%s: unregistered evdev provider: %s\n",
evdev->ev_shortname, evdev->ev_name);
@@ -364,7 +364,7 @@ evdev_unregister(struct evdev_dev *evdev)
EVDEV_LOCK(evdev);
evdev->ev_cdev->si_drv1 = NULL;
/* Wake up sleepers */
- LIST_FOREACH(client, &evdev->ev_clients, ec_link) {
+ LIST_FOREACH_SAFE(client, &evdev->ev_clients, ec_link, tmp) {
evdev_revoke_client(client);
evdev_dispose_client(evdev, client);
EVDEV_CLIENT_LOCKQ(client);
More information about the svn-src-stable-11
mailing list