summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/security.c
diff options
context:
space:
mode:
authorDaniel Jurgens <danielj@mellanox.com>2017-06-30 16:35:35 +0200
committerJames Morris <james.l.morris@oracle.com>2017-07-07 01:49:26 +0200
commit79d0636ac7f839d57680305a462f0d8ff9bb13ec (patch)
tree6893389e94fa681469cd5cc613aa01c05b2b9562 /drivers/infiniband/core/security.c
parenttpm: do not suspend/resume if power stays on (diff)
downloadlinux-79d0636ac7f839d57680305a462f0d8ff9bb13ec.tar.xz
linux-79d0636ac7f839d57680305a462f0d8ff9bb13ec.zip
IB/core: Fix uninitialized variable use in check_qp_port_pkey_settings
Check the return value from get_pkey_and_subnet_prefix to prevent using uninitialized variables. Fixes: d291f1a65232 ("IB/core: Enforce PKey security on QPs") Signed-off-by: Daniel Jurgens <danielj@mellanox.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Paul Moore <paul@paul-moore.com> Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'drivers/infiniband/core/security.c')
-rw-r--r--drivers/infiniband/core/security.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c
index 3e8c38953912..70ad19c4c73e 100644
--- a/drivers/infiniband/core/security.c
+++ b/drivers/infiniband/core/security.c
@@ -120,21 +120,25 @@ static int check_qp_port_pkey_settings(struct ib_ports_pkeys *pps,
return 0;
if (pps->main.state != IB_PORT_PKEY_NOT_VALID) {
- get_pkey_and_subnet_prefix(&pps->main,
- &pkey,
- &subnet_prefix);
+ ret = get_pkey_and_subnet_prefix(&pps->main,
+ &pkey,
+ &subnet_prefix);
+ if (ret)
+ return ret;
ret = enforce_qp_pkey_security(pkey,
subnet_prefix,
sec);
+ if (ret)
+ return ret;
}
- if (ret)
- return ret;
if (pps->alt.state != IB_PORT_PKEY_NOT_VALID) {
- get_pkey_and_subnet_prefix(&pps->alt,
- &pkey,
- &subnet_prefix);
+ ret = get_pkey_and_subnet_prefix(&pps->alt,
+ &pkey,
+ &subnet_prefix);
+ if (ret)
+ return ret;
ret = enforce_qp_pkey_security(pkey,
subnet_prefix,