diff options
author | Karsten Graul <kgraul@linux.ibm.com> | 2020-10-14 19:43:29 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-10-15 09:54:43 -0700 |
commit | 6b1bbf94ab369d97ed3bdaa561521a52c27ef619 (patch) | |
tree | 71b0f3f664252ab57d21661c989a399fc8889193 /net/smc | |
parent | ef12ad45880b696eb993d86c481ca891836ab593 (diff) |
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: 72b7f6c48708 ("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>
Diffstat (limited to 'net/smc')
-rw-r--r-- | net/smc/smc_core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 7c0e4fac9748..59cc99fec2a2 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -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); if (rc) { 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); /* CDC header stored in buf. So, pretend it was smaller */ |