xfrm: Add error handling when nla_put_u32() returns an error
BugLink: https://bugs.launchpad.net/bugs/2111953 commit 9d287e70c51f1c141ac588add261ed2efdd6fc6b upstream. Error handling is missing when call to nla_put_u32() fails. Handle the error when the call to nla_put_u32() returns an error. The error was reported by Coverity Scan. Report: CID 1601525: (#1 of 1): Unused value (UNUSED_VALUE) returned_value: Assigning value from nla_put_u32(skb, XFRMA_SA_PCPU, x->pcpu_num) to err here, but that stored value is overwritten before it can be used Fixes: 1ddf9916ac09 ("xfrm: Add support for per cpu xfrm state handling.") Signed-off-by: Everest K.C. <everestkc@everestkc.com.np> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Mehmet Basaran <mehmet.basaran@canonical.com>
This commit is contained in:
committed by
Mehmet Basaran
parent
12744694ae
commit
610b26a0fc
@@ -2484,8 +2484,11 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, const struct
|
||||
err = xfrm_if_id_put(skb, x->if_id);
|
||||
if (err)
|
||||
goto out_cancel;
|
||||
if (x->pcpu_num != UINT_MAX)
|
||||
if (x->pcpu_num != UINT_MAX) {
|
||||
err = nla_put_u32(skb, XFRMA_SA_PCPU, x->pcpu_num);
|
||||
if (err)
|
||||
goto out_cancel;
|
||||
}
|
||||
|
||||
nlmsg_end(skb, nlh);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user