clock: Add NULL check for best clock in clock_update_slave()
This scenario will only be encountered when the clock transitions to the slave state without knowing who the master is. This will result in a segfault for BMCA with designated master and slave states (to be added in upcoming patches). Signed-off-by: Vedang Patel <vedang.patel@intel.com>
This commit is contained in:
		
							parent
							
								
									4910055bd7
								
							
						
					
					
						commit
						386fc3ed89
					
				
							
								
								
									
										7
									
								
								clock.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								clock.c
									
									
									
									
									
								
							| @ -636,7 +636,12 @@ static void clock_update_grandmaster(struct clock *c) | ||||
| static void clock_update_slave(struct clock *c) | ||||
| { | ||||
| 	struct parentDS *pds = &c->dad.pds; | ||||
| 	struct ptp_message *msg        = TAILQ_FIRST(&c->best->messages); | ||||
| 	struct ptp_message *msg; | ||||
| 
 | ||||
| 	if (!c->best) | ||||
| 		return; | ||||
| 
 | ||||
| 	msg                            = TAILQ_FIRST(&c->best->messages); | ||||
| 	c->cur.stepsRemoved            = 1 + c->best->dataset.stepsRemoved; | ||||
| 	pds->parentPortIdentity        = c->best->dataset.sender; | ||||
| 	pds->grandmasterIdentity       = msg->announce.grandmasterIdentity; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user