Skip to content

Commit 82a4124

Browse files
committed
Merge: wireguard: stable backport for 10.1 phase 2
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1041 JIRA: https://issues.redhat.com/browse/RHEL-96621 * 71e5da4 wireguard: global: add __nonstring annotations for unterminated strings * c852902 wireguard: netlink: use NLA_POLICY_MASK where possible Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com> --- <small>Created 2025-06-13 03:34 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://issues.redhat.com/secure/CreateIssueDetails!init.jspa?pid=12334433&issuetype=1&priority=4&summary=backporter+webhook+issue&components=kernel-workflow+/+backporter)</small> Approved-by: Antoine Tenart <atenart@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents 27fe4f6 + 7311719 commit 82a4124

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

drivers/net/wireguard/cookie.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ void wg_cookie_checker_init(struct cookie_checker *checker,
2626
}
2727

2828
enum { COOKIE_KEY_LABEL_LEN = 8 };
29-
static const u8 mac1_key_label[COOKIE_KEY_LABEL_LEN] = "mac1----";
30-
static const u8 cookie_key_label[COOKIE_KEY_LABEL_LEN] = "cookie--";
29+
static const u8 mac1_key_label[COOKIE_KEY_LABEL_LEN] __nonstring = "mac1----";
30+
static const u8 cookie_key_label[COOKIE_KEY_LABEL_LEN] __nonstring = "cookie--";
3131

3232
static void precompute_key(u8 key[NOISE_SYMMETRIC_KEY_LEN],
3333
const u8 pubkey[NOISE_PUBLIC_KEY_LEN],

drivers/net/wireguard/netlink.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static const struct nla_policy device_policy[WGDEVICE_A_MAX + 1] = {
2424
[WGDEVICE_A_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
2525
[WGDEVICE_A_PRIVATE_KEY] = NLA_POLICY_EXACT_LEN(NOISE_PUBLIC_KEY_LEN),
2626
[WGDEVICE_A_PUBLIC_KEY] = NLA_POLICY_EXACT_LEN(NOISE_PUBLIC_KEY_LEN),
27-
[WGDEVICE_A_FLAGS] = { .type = NLA_U32 },
27+
[WGDEVICE_A_FLAGS] = NLA_POLICY_MASK(NLA_U32, __WGDEVICE_F_ALL),
2828
[WGDEVICE_A_LISTEN_PORT] = { .type = NLA_U16 },
2929
[WGDEVICE_A_FWMARK] = { .type = NLA_U32 },
3030
[WGDEVICE_A_PEERS] = { .type = NLA_NESTED }
@@ -33,7 +33,7 @@ static const struct nla_policy device_policy[WGDEVICE_A_MAX + 1] = {
3333
static const struct nla_policy peer_policy[WGPEER_A_MAX + 1] = {
3434
[WGPEER_A_PUBLIC_KEY] = NLA_POLICY_EXACT_LEN(NOISE_PUBLIC_KEY_LEN),
3535
[WGPEER_A_PRESHARED_KEY] = NLA_POLICY_EXACT_LEN(NOISE_SYMMETRIC_KEY_LEN),
36-
[WGPEER_A_FLAGS] = { .type = NLA_U32 },
36+
[WGPEER_A_FLAGS] = NLA_POLICY_MASK(NLA_U32, __WGPEER_F_ALL),
3737
[WGPEER_A_ENDPOINT] = NLA_POLICY_MIN_LEN(sizeof(struct sockaddr)),
3838
[WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL] = { .type = NLA_U16 },
3939
[WGPEER_A_LAST_HANDSHAKE_TIME] = NLA_POLICY_EXACT_LEN(sizeof(struct __kernel_timespec)),
@@ -373,9 +373,6 @@ static int set_peer(struct wg_device *wg, struct nlattr **attrs)
373373

374374
if (attrs[WGPEER_A_FLAGS])
375375
flags = nla_get_u32(attrs[WGPEER_A_FLAGS]);
376-
ret = -EOPNOTSUPP;
377-
if (flags & ~__WGPEER_F_ALL)
378-
goto out;
379376

380377
ret = -EPFNOSUPPORT;
381378
if (attrs[WGPEER_A_PROTOCOL_VERSION]) {
@@ -506,9 +503,6 @@ static int wg_set_device(struct sk_buff *skb, struct genl_info *info)
506503

507504
if (info->attrs[WGDEVICE_A_FLAGS])
508505
flags = nla_get_u32(info->attrs[WGDEVICE_A_FLAGS]);
509-
ret = -EOPNOTSUPP;
510-
if (flags & ~__WGDEVICE_F_ALL)
511-
goto out;
512506

513507
if (info->attrs[WGDEVICE_A_LISTEN_PORT] || info->attrs[WGDEVICE_A_FWMARK]) {
514508
struct net *net;

drivers/net/wireguard/noise.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
* <- e, ee, se, psk, {}
2626
*/
2727

28-
static const u8 handshake_name[37] = "Noise_IKpsk2_25519_ChaChaPoly_BLAKE2s";
29-
static const u8 identifier_name[34] = "WireGuard v1 zx2c4 Jason@zx2c4.com";
28+
static const u8 handshake_name[37] __nonstring = "Noise_IKpsk2_25519_ChaChaPoly_BLAKE2s";
29+
static const u8 identifier_name[34] __nonstring = "WireGuard v1 zx2c4 Jason@zx2c4.com";
3030
static u8 handshake_init_hash[NOISE_HASH_LEN] __ro_after_init;
3131
static u8 handshake_init_chaining_key[NOISE_HASH_LEN] __ro_after_init;
3232
static atomic64_t keypair_counter = ATOMIC64_INIT(0);

0 commit comments

Comments
 (0)