Skip to content

Commit 6b1bbf9

Browse files
karstengrkuba-moo
authored andcommitted
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: 72b7f6c ("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>
1 parent ef12ad4 commit 6b1bbf9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

net/smc/smc_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,8 @@ static struct smc_buf_desc *smcd_new_buf_create(struct smc_link_group *lgr,
16161616
rc = smc_ism_register_dmb(lgr, bufsize, buf_desc);
16171617
if (rc) {
16181618
kfree(buf_desc);
1619-
return (rc == -ENOMEM) ? ERR_PTR(-EAGAIN) : ERR_PTR(rc);
1619+
return (rc == -ENOMEM) ? ERR_PTR(-EAGAIN) :
1620+
ERR_PTR(-EIO);
16201621
}
16211622
buf_desc->pages = virt_to_page(buf_desc->cpu_addr);
16221623
/* CDC header stored in buf. So, pretend it was smaller */

0 commit comments

Comments
 (0)