Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang committed Oct 29, 2024
1 parent dff99f2 commit f6937af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 6 additions & 5 deletions net/mptcp/pm_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,10 @@ static int mptcp_pm_nl_dump_addr(struct mptcp_id_bitmap *bitmap,
struct pm_nl_pernet *pernet;

pernet = pm_nl_get_pernet(net);

spin_lock_bh(&pernet->lock);
bitmap_copy(bitmap->map, pernet->id_bitmap.map, MPTCP_PM_MAX_ADDR_ID + 1);
spin_unlock_bh(&pernet->lock);

return 0;
}
Expand All @@ -1877,17 +1880,15 @@ int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg,
{
const struct genl_info *info = genl_info_dump(cb);
struct mptcp_pm_addr_entry entry;
struct mptcp_id_bitmap *id_bitmap;
struct mptcp_id_bitmap id_bitmap;
int id = cb->args[0];
void *hdr;
int i;

id_bitmap = (struct mptcp_id_bitmap *)cb->ctx;
if (!id)
mptcp_pm_dump_addr(id_bitmap, info);
mptcp_pm_dump_addr(&id_bitmap, info);

for (i = id; i < MPTCP_PM_MAX_ADDR_ID + 1; i++) {
if (test_bit(i, id_bitmap->map)) {
if (test_bit(i, id_bitmap.map)) {
if (mptcp_pm_get_addr(i, &entry, info))
break;

Expand Down
2 changes: 2 additions & 0 deletions net/mptcp/pm_userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,8 @@ static int mptcp_userspace_pm_set_bitmap(struct mptcp_sock *msk,
{
struct mptcp_pm_addr_entry *entry;

bitmap_zero(bitmap->map, MPTCP_PM_MAX_ADDR_ID + 1);

mptcp_for_each_address(msk, entry) {
if (test_bit(entry->addr.id, bitmap->map))
continue;
Expand Down
2 changes: 2 additions & 0 deletions tools/testing/selftests/bpf/progs/mptcp_bpf_userspace_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ static int mptcp_userspace_pm_set_bitmap(struct mptcp_sock *msk,
{
struct mptcp_pm_addr_entry *entry;

bpf_bitmap_zero(bitmap);

mptcp_for_each_address(msk, entry) {
entry = bpf_core_cast(entry, struct mptcp_pm_addr_entry);

Expand Down

0 comments on commit f6937af

Please sign in to comment.