Skip to contentSkip to conversation

cgroup: fix rcu_read_lock() leak in update_if_frozen()

PATCH Applied Tejun Heo 1 participant 2 messages May 10, 2014 – May 13, 2014 1 message not in the archive cgroup

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 5369104d.Nn5Lpp7nwOehwnnC%[email protected]

Tejun Heo

author maintainer
#1 lore raw

PATCH 1/1 cgroup: fix rcu_read_lock() leak in update_if_frozen()

While updating cgroup_freezer locking, 68fafb77d827 ("cgroup_freezer:
replace freezer->lock with freezer_mutex") introduced a bug in update_if_frozen() where it returns with rcu_read_lock() held. Fix it by adding rcu_read_unlock() before returning.

---
 kernel/cgroup_freezer.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/cgroup_freezer.c +3 -1
@@ -267,8 +267,10 @@ static void update_if_frozen(struct cgro
 		struct freezer *child = css_freezer(pos);
 
 		if ((child->state & CGROUP_FREEZER_ONLINE) &&
-		    !(child->state & CGROUP_FROZEN))
+		    !(child->state & CGROUP_FROZEN)) {
+			rcu_read_unlock();
 			return;
+		}
 	}
 	rcu_read_unlock();
 
author maintainer Applied
#2 lore raw
Quoted 7 lines · Tejun Heo

While updating cgroup_freezer locking, 68fafb77d827 ("cgroup_freezer:
replace freezer->lock with freezer_mutex") introduced a bug in update_if_frozen() where it returns with rcu_read_lock() held. Fix it by adding rcu_read_unlock() before returning.

Applied to cgroup/for-3.15-fixes.

Thanks.

Signature · 1 line
tejun