Skip to content

Commit 0abd40f

Browse files
geliangtangdavem330
authored andcommitted
mptcp: add struct mptcp_pm_add_entry
Add a new struct mptcp_pm_add_entry to describe add_addr's entry. Acked-by: Paolo Abeni <[email protected]> Signed-off-by: Geliang Tang <[email protected]> Reviewed-by: Mat Martineau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent dd72b0f commit 0abd40f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

net/mptcp/pm_netlink.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ struct mptcp_pm_addr_entry {
2828
struct rcu_head rcu;
2929
};
3030

31+
struct mptcp_pm_add_entry {
32+
struct list_head list;
33+
struct mptcp_addr_info addr;
34+
};
35+
3136
struct pm_nl_pernet {
3237
/* protects pernet updates */
3338
spinlock_t lock;
@@ -181,7 +186,7 @@ static void check_work_pending(struct mptcp_sock *msk)
181186
static bool lookup_anno_list_by_saddr(struct mptcp_sock *msk,
182187
struct mptcp_addr_info *addr)
183188
{
184-
struct mptcp_pm_addr_entry *entry;
189+
struct mptcp_pm_add_entry *entry;
185190

186191
list_for_each_entry(entry, &msk->pm.anno_list, list) {
187192
if (addresses_equal(&entry->addr, addr, false))
@@ -194,23 +199,23 @@ static bool lookup_anno_list_by_saddr(struct mptcp_sock *msk,
194199
static bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
195200
struct mptcp_pm_addr_entry *entry)
196201
{
197-
struct mptcp_pm_addr_entry *clone = NULL;
202+
struct mptcp_pm_add_entry *add_entry = NULL;
198203

199204
if (lookup_anno_list_by_saddr(msk, &entry->addr))
200205
return false;
201206

202-
clone = kmemdup(entry, sizeof(*entry), GFP_ATOMIC);
203-
if (!clone)
207+
add_entry = kmalloc(sizeof(*add_entry), GFP_ATOMIC);
208+
if (!add_entry)
204209
return false;
205210

206-
list_add(&clone->list, &msk->pm.anno_list);
211+
list_add(&add_entry->list, &msk->pm.anno_list);
207212

208213
return true;
209214
}
210215

211216
void mptcp_pm_free_anno_list(struct mptcp_sock *msk)
212217
{
213-
struct mptcp_pm_addr_entry *entry, *tmp;
218+
struct mptcp_pm_add_entry *entry, *tmp;
214219

215220
pr_debug("msk=%p", msk);
216221

@@ -654,7 +659,7 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id)
654659
static bool remove_anno_list_by_saddr(struct mptcp_sock *msk,
655660
struct mptcp_addr_info *addr)
656661
{
657-
struct mptcp_pm_addr_entry *entry, *tmp;
662+
struct mptcp_pm_add_entry *entry, *tmp;
658663

659664
list_for_each_entry_safe(entry, tmp, &msk->pm.anno_list, list) {
660665
if (addresses_equal(&entry->addr, addr, false)) {

0 commit comments

Comments
 (0)