summaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/device.c
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2009-08-23 18:09:04 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-08-23 18:10:00 +0200
commit06739a8ad321b1e5140b318c648b0cc4bf8c6daa (patch)
treefdbee8b3b657fbd206a223d06d930931e8efb4c8 /drivers/s390/cio/device.c
parent3edf2fb9d80a46d6c32ba12547a42419845b4b76 (diff)
downloadlinux-06739a8ad321b1e5140b318c648b0cc4bf8c6daa.tar.bz2
[S390] cio: fix double free after failed device initialization
If io_subchannel_initialize_dev fails it will release the only reference to the ccw device therefore the caller should not kfree this device since this is done in the release function. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/device.c')
-rw-r--r--drivers/s390/cio/device.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 3c57c1a18bb8..d593bc76afe3 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -772,10 +772,8 @@ static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch)
cdev = io_subchannel_allocate_dev(sch);
if (!IS_ERR(cdev)) {
ret = io_subchannel_initialize_dev(sch, cdev);
- if (ret) {
- kfree(cdev);
+ if (ret)
cdev = ERR_PTR(ret);
- }
}
return cdev;
}