From: Eric Dumazet <eduma...@google.com> Date: Thu, 27 Jun 2019 01:27:01 -0700
> im->tomb and/or im->sources might not be NULL, but we > currently overwrite their values blindly. > > Using swap() will make sure the following call to kfree_pmc(pmc) > will properly free the psf structures. > > Tested with the C repro provided by syzbot, which basically does : > > socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3 > setsockopt(3, SOL_IP, IP_ADD_MEMBERSHIP, "\340\0\0\2\177\0\0\1\0\0\0\0", 12) > = 0 > ioctl(3, SIOCSIFFLAGS, {ifr_name="lo", ifr_flags=0}) = 0 > setsockopt(3, SOL_IP, IP_MSFILTER, > "\340\0\0\2\177\0\0\1\1\0\0\0\1\0\0\0\377\377\377\377", 20) = 0 > ioctl(3, SIOCSIFFLAGS, {ifr_name="lo", ifr_flags=IFF_UP}) = 0 > exit_group(0) = ? > > BUG: memory leak > unreferenced object 0xffff88811450f140 (size 64): ... > Fixes: 24803f38a5c0 ("igmp: do not remove igmp souce list info when set link > down") > Signed-off-by: Eric Dumazet <eduma...@google.com> > Cc: Hangbin Liu <liuhang...@gmail.com> > Reported-by: syzbot+6ca1abd0db68b5173...@syzkaller.appspotmail.com Applied and queued up for -stable, thanks.