Skip to content

Commit 610b26a

Browse files
everestkcmehmetb0
authored andcommitted
xfrm: Add error handling when nla_put_u32() returns an error
BugLink: https://bugs.launchpad.net/bugs/2111953 commit 9d287e7 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: 1ddf991 ("xfrm: Add support for per cpu xfrm state handling.") Signed-off-by: Everest K.C. <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Steffen Klassert <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Manuel Diewald <[email protected]> Signed-off-by: Mehmet Basaran <[email protected]>
1 parent 1274469 commit 610b26a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/xfrm/xfrm_user.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2484,8 +2484,11 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, const struct
24842484
err = xfrm_if_id_put(skb, x->if_id);
24852485
if (err)
24862486
goto out_cancel;
2487-
if (x->pcpu_num != UINT_MAX)
2487+
if (x->pcpu_num != UINT_MAX) {
24882488
err = nla_put_u32(skb, XFRMA_SA_PCPU, x->pcpu_num);
2489+
if (err)
2490+
goto out_cancel;
2491+
}
24892492

24902493
nlmsg_end(skb, nlh);
24912494
return 0;

0 commit comments

Comments
 (0)