Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85acc407 authored by Cornelia Huck's avatar Cornelia Huck Committed by Martin Schwidefsky
Browse files

[S390] cio: Fix refcount after moving devices.



In ccw_device_move_to_orphanage(), a replacing ccw_device
is searched via get_{disc,orphaned}_ccwdev_by_dev_id()
which obtain a reference on the returned ccw_device.
This reference must be given up again after the device
has been moved to its new parent.

Signed-off-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 50bec4ce
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -874,11 +874,15 @@ void ccw_device_move_to_orphanage(struct work_struct *work)
	replacing_cdev = get_disc_ccwdev_by_dev_id(&dev_id, cdev);
	if (replacing_cdev) {
		sch_attach_disconnected_device(sch, replacing_cdev);
		/* Release reference from get_disc_ccwdev_by_dev_id() */
		put_device(&cdev->dev);
		return;
	}
	replacing_cdev = get_orphaned_ccwdev_by_dev_id(css, &dev_id);
	if (replacing_cdev) {
		sch_attach_orphaned_device(sch, replacing_cdev);
		/* Release reference from get_orphaned_ccwdev_by_dev_id() */
		put_device(&cdev->dev);
		return;
	}
	sch_create_and_recog_new_device(sch);