mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	pidns: fix free_pid() to handle the first fork failure
"case 0" in free_pid() assumes that disable_pid_allocation() should clear PIDNS_HASH_ADDING before the last pid goes away. However this doesn't happen if the first fork() fails to create the child reaper which should call disable_pid_allocation(). Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com> Cc: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									4271b05a22
								
							
						
					
					
						commit
						314a8ad0f1
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -273,6 +273,11 @@ void free_pid(struct pid *pid)
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
			wake_up_process(ns->child_reaper);
 | 
								wake_up_process(ns->child_reaper);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
							case PIDNS_HASH_ADDING:
 | 
				
			||||||
 | 
								/* Handle a fork failure of the first process */
 | 
				
			||||||
 | 
								WARN_ON(ns->child_reaper);
 | 
				
			||||||
 | 
								ns->nr_hashed = 0;
 | 
				
			||||||
 | 
								/* fall through */
 | 
				
			||||||
		case 0:
 | 
							case 0:
 | 
				
			||||||
			schedule_work(&ns->proc_work);
 | 
								schedule_work(&ns->proc_work);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue