mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net/smc: fix invalid return code in smcd_new_buf_create()
smc_ism_register_dmb() returns error codes set by the ISM driver which
are not guaranteed to be negative or in the errno range. Such values
would not be handled by ERR_PTR() and finally the return code will be
used as a memory address.
Fix that by using a valid negative errno value with ERR_PTR().
Fixes: 72b7f6c487 ("net/smc: unique reason code for exceeded max dmb count")
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
			
			
This commit is contained in:
		
							parent
							
								
									ef12ad4588
								
							
						
					
					
						commit
						6b1bbf94ab
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -1616,7 +1616,8 @@ static struct smc_buf_desc *smcd_new_buf_create(struct smc_link_group *lgr,
 | 
				
			||||||
		rc = smc_ism_register_dmb(lgr, bufsize, buf_desc);
 | 
							rc = smc_ism_register_dmb(lgr, bufsize, buf_desc);
 | 
				
			||||||
		if (rc) {
 | 
							if (rc) {
 | 
				
			||||||
			kfree(buf_desc);
 | 
								kfree(buf_desc);
 | 
				
			||||||
			return (rc == -ENOMEM) ? ERR_PTR(-EAGAIN) : ERR_PTR(rc);
 | 
								return (rc == -ENOMEM) ? ERR_PTR(-EAGAIN) :
 | 
				
			||||||
 | 
											 ERR_PTR(-EIO);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		buf_desc->pages = virt_to_page(buf_desc->cpu_addr);
 | 
							buf_desc->pages = virt_to_page(buf_desc->cpu_addr);
 | 
				
			||||||
		/* CDC header stored in buf. So, pretend it was smaller */
 | 
							/* CDC header stored in buf. So, pretend it was smaller */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue