Re: KASAN: slab-out-of-bounds Read in bitmap_port_destroy

From: Dan Carpenter
Date: Fri Jan 24 2020 - 04:12:33 EST


On Fri, Jan 24, 2020 at 04:55:21PM +0800, Hillf Danton wrote:
> Ensure four bytes and ask slab to do the rest.
>
> --- a/include/linux/netfilter/ipset/ip_set.h
> +++ b/include/linux/netfilter/ipset/ip_set.h
> @@ -430,7 +430,7 @@ ip6addrptr(const struct sk_buff *skb, bo
> static inline int
> bitmap_bytes(u32 a, u32 b)
> {
> - return 4 * ((((b - a + 8) / 8) + 3) / 4);
> + return 4 + (b - a) / 8;
> }
>

Thanks, but this was already fixed by:

https://lore.kernel.org/netfilter-devel/alpine.DEB.2.20.2001192203200.18095@xxxxxxxxxxxxxxxxx/

regards,
dan carpenter