]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
[S390] cio: fix double free after failed device initialization
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Sun, 23 Aug 2009 16:09:04 +0000 (18:09 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Sun, 23 Aug 2009 16:10:00 +0000 (18:10 +0200)
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>
drivers/s390/cio/device.c

index 3c57c1a18bb8772db79a73159a98244ae4c89972..d593bc76afe316478374f99e970a37f469cebbf9 100644 (file)
@@ -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;
 }