mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	pstore: Improve register_pstore() error reporting
Uncommon errors are better to get reported to dmesg so developers can more easily figure out why pstore is unhappy with a backend attempting to register. Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
		
							parent
							
								
									1344dd86f3
								
							
						
					
					
						commit
						0d7cd09a3d
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -673,11 +673,15 @@ int pstore_register(struct pstore_info *psi)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct module *owner = psi->owner;
 | 
						struct module *owner = psi->owner;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (backend && strcmp(backend, psi->name))
 | 
						if (backend && strcmp(backend, psi->name)) {
 | 
				
			||||||
 | 
							pr_warn("ignoring unexpected backend '%s'\n", psi->name);
 | 
				
			||||||
		return -EPERM;
 | 
							return -EPERM;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&pstore_lock);
 | 
						spin_lock(&pstore_lock);
 | 
				
			||||||
	if (psinfo) {
 | 
						if (psinfo) {
 | 
				
			||||||
 | 
							pr_warn("backend '%s' already loaded: ignoring '%s'\n",
 | 
				
			||||||
 | 
								psinfo->name, psi->name);
 | 
				
			||||||
		spin_unlock(&pstore_lock);
 | 
							spin_unlock(&pstore_lock);
 | 
				
			||||||
		return -EBUSY;
 | 
							return -EBUSY;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue