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

Commit 06739a8a authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky
Browse files

[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: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 3edf2fb9
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -772,11 +772,9 @@ static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch)
	cdev = io_subchannel_allocate_dev(sch);
	cdev = io_subchannel_allocate_dev(sch);
	if (!IS_ERR(cdev)) {
	if (!IS_ERR(cdev)) {
		ret = io_subchannel_initialize_dev(sch, cdev);
		ret = io_subchannel_initialize_dev(sch, cdev);
		if (ret) {
		if (ret)
			kfree(cdev);
			cdev = ERR_PTR(ret);
			cdev = ERR_PTR(ret);
	}
	}
	}
	return cdev;
	return cdev;
}
}