diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2008-11-14 12:18:06 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-11-14 12:18:54 -0500 |
commit | 85acc407bf1c49fb40b8f461c2c7526af736d87e (patch) | |
tree | 356a407f2f621fc50cba45d0453958e7143738a1 | |
parent | 50bec4ce5d36ebf96189dcc54e20c7fce4bf61bf (diff) |
[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: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/cio/device.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 4e78c82194b4..4e4008325e28 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -874,11 +874,15 @@ void ccw_device_move_to_orphanage(struct work_struct *work) | |||
874 | replacing_cdev = get_disc_ccwdev_by_dev_id(&dev_id, cdev); | 874 | replacing_cdev = get_disc_ccwdev_by_dev_id(&dev_id, cdev); |
875 | if (replacing_cdev) { | 875 | if (replacing_cdev) { |
876 | sch_attach_disconnected_device(sch, replacing_cdev); | 876 | sch_attach_disconnected_device(sch, replacing_cdev); |
877 | /* Release reference from get_disc_ccwdev_by_dev_id() */ | ||
878 | put_device(&cdev->dev); | ||
877 | return; | 879 | return; |
878 | } | 880 | } |
879 | replacing_cdev = get_orphaned_ccwdev_by_dev_id(css, &dev_id); | 881 | replacing_cdev = get_orphaned_ccwdev_by_dev_id(css, &dev_id); |
880 | if (replacing_cdev) { | 882 | if (replacing_cdev) { |
881 | sch_attach_orphaned_device(sch, replacing_cdev); | 883 | sch_attach_orphaned_device(sch, replacing_cdev); |
884 | /* Release reference from get_orphaned_ccwdev_by_dev_id() */ | ||
885 | put_device(&cdev->dev); | ||
882 | return; | 886 | return; |
883 | } | 887 | } |
884 | sch_create_and_recog_new_device(sch); | 888 | sch_create_and_recog_new_device(sch); |