Skip to content

Commit 83dfce3

Browse files
committed
xfrm: Restrict percpu SA attribute to specific netlink message types
Reject the usage of XFRMA_SA_PCPU in xfrm netlink messages when it's not applicable. Signed-off-by: Steffen Klassert <[email protected]> Tested-by: Antony Antony <[email protected]> Tested-by: Tobias Brunner <[email protected]>
1 parent 81a331a commit 83dfce3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

net/xfrm/xfrm_user.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,6 +3282,20 @@ static int xfrm_reject_unused_attr(int type, struct nlattr **attrs,
32823282
}
32833283
}
32843284

3285+
if (attrs[XFRMA_SA_PCPU]) {
3286+
switch (type) {
3287+
case XFRM_MSG_NEWSA:
3288+
case XFRM_MSG_UPDSA:
3289+
case XFRM_MSG_ALLOCSPI:
3290+
case XFRM_MSG_ACQUIRE:
3291+
3292+
break;
3293+
default:
3294+
NL_SET_ERR_MSG(extack, "Invalid attribute SA_PCPU");
3295+
return -EINVAL;
3296+
}
3297+
}
3298+
32853299
return 0;
32863300
}
32873301

0 commit comments

Comments
 (0)