mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	af_unix: Defer sock_put() to clean up path in unix_dgram_sendmsg().
When other has SOCK_DEAD in unix_dgram_sendmsg(), we call sock_put() for it first and then set NULL to other before jumping to the error path. This is to skip sock_put() in the error path. Let's not set NULL to other and defer the sock_put() to the error path to clean up the labels later. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
		
							parent
							
								
									a700b43358
								
							
						
					
					
						commit
						689c398885
					
				
					 1 changed files with 0 additions and 2 deletions
				
			
		| 
						 | 
					@ -2075,7 +2075,6 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
 | 
				
			||||||
		 *	datagram error
 | 
							 *	datagram error
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		unix_state_unlock(other);
 | 
							unix_state_unlock(other);
 | 
				
			||||||
		sock_put(other);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!sk_locked)
 | 
							if (!sk_locked)
 | 
				
			||||||
			unix_state_lock(sk);
 | 
								unix_state_lock(sk);
 | 
				
			||||||
| 
						 | 
					@ -2104,7 +2103,6 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
 | 
				
			||||||
				err = -ECONNRESET;
 | 
									err = -ECONNRESET;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		other = NULL;
 | 
					 | 
				
			||||||
		if (err)
 | 
							if (err)
 | 
				
			||||||
			goto out_free;
 | 
								goto out_free;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue