On 9/15/16 6:14 PM, Mahesh Bandewar wrote: > diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h > index 695a5dc9ace3..371f4548c42d 100644 > --- a/drivers/net/ipvlan/ipvlan.h > +++ b/drivers/net/ipvlan/ipvlan.h > @@ -23,11 +23,13 @@ > #include <linux/if_vlan.h> > #include <linux/ip.h> > #include <linux/inetdevice.h> > +#include <linux/netfilter.h> > #include <net/ip.h> > #include <net/ip6_route.h> > #include <net/rtnetlink.h> > #include <net/route.h> > #include <net/addrconf.h> > +#include <net/l3mdev.h> > > #define IPVLAN_DRV "ipvlan" > #define IPV_DRV_VER "0.1" > @@ -96,6 +98,7 @@ struct ipvl_port { > struct work_struct wq; > struct sk_buff_head backlog; > int count; > + bool hooks_attached;
With a refcnt on the hook registration you don't need this bool and removing simplifies the set_mode logic. > diff --git a/drivers/net/ipvlan/ipvlan_main.c > b/drivers/net/ipvlan/ipvlan_main.c > index 18b4e8c7f68a..aca690f41559 100644 > --- a/drivers/net/ipvlan/ipvlan_main.c > +++ b/drivers/net/ipvlan/ipvlan_main.c .... > +static void ipvlan_unregister_nf_hook(void) > +{ > + BUG_ON(!ipvl_nf_hook_refcnt); not a panic() worthy issue. just a pr_warn or WARN_ON_ONCE should be ok.