mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	cgroup: fix alloc_cgroup_ns() error handling in copy_cgroup_ns()
alloc_cgroup_ns() returns an ERR_PTR value on error but copy_cgroup_ns() was checking for NULL for error. Fix it. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
This commit is contained in:
		
							parent
							
								
									1c53753e0d
								
							
						
					
					
						commit
						d22025570e
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -6083,10 +6083,11 @@ struct cgroup_namespace *copy_cgroup_ns(unsigned long flags,
 | 
				
			||||||
	spin_unlock_bh(&css_set_lock);
 | 
						spin_unlock_bh(&css_set_lock);
 | 
				
			||||||
	mutex_unlock(&cgroup_mutex);
 | 
						mutex_unlock(&cgroup_mutex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = -ENOMEM;
 | 
					 | 
				
			||||||
	new_ns = alloc_cgroup_ns();
 | 
						new_ns = alloc_cgroup_ns();
 | 
				
			||||||
	if (!new_ns)
 | 
						if (IS_ERR(new_ns)) {
 | 
				
			||||||
 | 
							err = PTR_ERR(new_ns);
 | 
				
			||||||
		goto err_out;
 | 
							goto err_out;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	new_ns->user_ns = get_user_ns(user_ns);
 | 
						new_ns->user_ns = get_user_ns(user_ns);
 | 
				
			||||||
	new_ns->root_cset = cset;
 | 
						new_ns->root_cset = cset;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue