Skip to content

Commit 9c8bb16

Browse files
liuhangbindavem330
authored andcommitted
igmp, mld: Fix memory leak in igmpv3/mld_del_delrec()
In function igmpv3/mld_add_delrec() we allocate pmc and put it in idev->mc_tomb, so we should free it when we don't need it in del_delrec(). But I removed kfree(pmc) incorrectly in latest two patches. Now fix it. Fixes: 24803f3 ("igmp: do not remove igmp souce list info when ...") Fixes: 1666d49 ("mld: do not remove mld souce list info when ...") Reported-by: Daniel Borkmann <[email protected]> Signed-off-by: Hangbin Liu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e2e004a commit 9c8bb16

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

net/ipv4/igmp.c

+1
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,7 @@ static void igmpv3_del_delrec(struct in_device *in_dev, struct ip_mc_list *im)
11721172
psf->sf_crcount = im->crcount;
11731173
}
11741174
in_dev_put(pmc->interface);
1175+
kfree(pmc);
11751176
}
11761177
spin_unlock_bh(&im->lock);
11771178
}

net/ipv6/mcast.c

+1
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
779779
psf->sf_crcount = im->mca_crcount;
780780
}
781781
in6_dev_put(pmc->idev);
782+
kfree(pmc);
782783
}
783784
spin_unlock_bh(&im->mca_lock);
784785
}

0 commit comments

Comments
 (0)