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: d291f1a652 ("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>
This commit is contained in:
committed by
James Morris
parent
b5d0ebc99b
commit
79d0636ac7
@@ -120,21 +120,25 @@ static int check_qp_port_pkey_settings(struct ib_ports_pkeys *pps,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (pps->main.state != IB_PORT_PKEY_NOT_VALID) {
|
if (pps->main.state != IB_PORT_PKEY_NOT_VALID) {
|
||||||
get_pkey_and_subnet_prefix(&pps->main,
|
ret = get_pkey_and_subnet_prefix(&pps->main,
|
||||||
&pkey,
|
&pkey,
|
||||||
&subnet_prefix);
|
&subnet_prefix);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = enforce_qp_pkey_security(pkey,
|
ret = enforce_qp_pkey_security(pkey,
|
||||||
subnet_prefix,
|
subnet_prefix,
|
||||||
sec);
|
sec);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (pps->alt.state != IB_PORT_PKEY_NOT_VALID) {
|
if (pps->alt.state != IB_PORT_PKEY_NOT_VALID) {
|
||||||
get_pkey_and_subnet_prefix(&pps->alt,
|
ret = get_pkey_and_subnet_prefix(&pps->alt,
|
||||||
&pkey,
|
&pkey,
|
||||||
&subnet_prefix);
|
&subnet_prefix);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = enforce_qp_pkey_security(pkey,
|
ret = enforce_qp_pkey_security(pkey,
|
||||||
subnet_prefix,
|
subnet_prefix,
|
||||||
|
|||||||
Reference in New Issue
Block a user