Skip to content

Commit

Permalink
[S390] cio: fix double free after failed device initialization
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sebastian Ott authored and Martin Schwidefsky committed Aug 23, 2009
1 parent 3edf2fb commit 06739a8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/s390/cio/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 06739a8

Please sign in to comment.