From: Tejun Heo Date: Tue, 14 May 2013 20:52:30 +0000 (-0700) Subject: blkcg: fix error return path in blkg_create() X-Git-Tag: MMI-PSA29.97-13-9~13965^2~53 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2423c9c3f0ffffa8f87cbdafe9781273c5d1b6a2;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git blkcg: fix error return path in blkg_create() In blkg_create(), after lookup of parent fails, the control jumps to error path with the error code encoded into @blkg. The error path doesn't use @blkg for the return value. It returns ERR_PTR(ret). Make lookup fail path set @ret instead of @blkg. Note that the parent lookup is guaranteed to succeed at that point and the condition check is purely for sanity and triggers WARN when fails. As such, I don't think it's necessary to mark it for -stable. Signed-off-by: Tejun Heo Acked-by: Vivek Goyal --- diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index e8918ffaf96d..7fc35f683c4e 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -238,7 +238,7 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg, if (blkcg_parent(blkcg)) { blkg->parent = __blkg_lookup(blkcg_parent(blkcg), q, false); if (WARN_ON_ONCE(!blkg->parent)) { - blkg = ERR_PTR(-EINVAL); + ret = -EINVAL; goto err_put_css; } blkg_get(blkg->parent);