Skip to content

Commit adfaf66

Browse files
author
CKI KWF Bot
committed
Merge: tipc: stable backport for 9.8 phase 2
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7417 JIRA: https://issues.redhat.com/browse/RHEL-115652 This MR backports important fixes from upstream for RHEL-9.8. Signed-off-by: Xin Long <lxin@redhat.com> Approved-by: Antoine Tenart <atenart@redhat.com> Approved-by: Florian Westphal <fwestpha@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 8e91b84 + c47c74f commit adfaf66

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

net/tipc/crypto.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static void tipc_aead_free(struct rcu_head *rp)
425425
}
426426
free_percpu(aead->tfm_entry);
427427
kfree_sensitive(aead->key);
428-
kfree(aead);
428+
kfree_sensitive(aead);
429429
}
430430

431431
static int tipc_aead_users(struct tipc_aead __rcu *aead)
@@ -2302,8 +2302,8 @@ static bool tipc_crypto_key_rcv(struct tipc_crypto *rx, struct tipc_msg *hdr)
23022302
keylen = ntohl(*((__be32 *)(data + TIPC_AEAD_ALG_NAME)));
23032303

23042304
/* Verify the supplied size values */
2305-
if (unlikely(size != keylen + sizeof(struct tipc_aead_key) ||
2306-
keylen > TIPC_AEAD_KEY_SIZE_MAX)) {
2305+
if (unlikely(keylen > TIPC_AEAD_KEY_SIZE_MAX ||
2306+
size != keylen + sizeof(struct tipc_aead_key))) {
23072307
pr_debug("%s: invalid MSG_CRYPTO key size\n", rx->name);
23082308
goto exit;
23092309
}

net/tipc/link.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,
10531053
if (unlikely(l->backlog[imp].len >= l->backlog[imp].limit)) {
10541054
if (imp == TIPC_SYSTEM_IMPORTANCE) {
10551055
pr_warn("%s<%s>, link overflow", link_rst_msg, l->name);
1056+
__skb_queue_purge(list);
10561057
return -ENOBUFS;
10571058
}
10581059
rc = link_schedule_user(l, hdr);

net/tipc/monitor.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ void tipc_mon_reinit_self(struct net *net)
716716
if (!mon)
717717
continue;
718718
write_lock_bh(&mon->lock);
719-
mon->self->addr = tipc_own_addr(net);
719+
if (mon->self)
720+
mon->self->addr = tipc_own_addr(net);
720721
write_unlock_bh(&mon->lock);
721722
}
722723
}

net/tipc/name_table.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,8 @@ void tipc_nametbl_stop(struct net *net)
949949
}
950950
spin_unlock_bh(&tn->nametbl_lock);
951951

952-
synchronize_net();
953-
kfree(nt);
952+
/* TODO: clear tn->nametbl, implement proper RCU rules ? */
953+
kfree_rcu(nt, rcu);
954954
}
955955

956956
static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg,

net/tipc/name_table.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct publication {
9090

9191
/**
9292
* struct name_table - table containing all existing port name publications
93+
* @rcu: RCU callback head used for deferred freeing
9394
* @services: name sequence hash lists
9495
* @node_scope: all local publications with node scope
9596
* - used by name_distr during re-init of name table
@@ -102,6 +103,7 @@ struct publication {
102103
* @snd_nxt: next sequence number to be used
103104
*/
104105
struct name_table {
106+
struct rcu_head rcu;
105107
struct hlist_head services[TIPC_NAMETBL_SIZE];
106108
struct list_head node_scope;
107109
struct list_head cluster_scope;

net/tipc/udp_media.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb)
489489

490490
rtnl_lock();
491491
b = tipc_bearer_find(net, bname);
492-
if (!b) {
492+
if (!b || b->bcast_addr.media_id != TIPC_MEDIA_TYPE_UDP) {
493493
rtnl_unlock();
494494
return -EINVAL;
495495
}
@@ -500,7 +500,7 @@ int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb)
500500

501501
rtnl_lock();
502502
b = rtnl_dereference(tn->bearer_list[bid]);
503-
if (!b) {
503+
if (!b || b->bcast_addr.media_id != TIPC_MEDIA_TYPE_UDP) {
504504
rtnl_unlock();
505505
return -EINVAL;
506506
}

0 commit comments

Comments
 (0)