Subject: WARNING: proc registration bug in clusterip_tg_check

From: syzbot <[email-masked]>
Date: Wed, 07 Feb 2018 03:04:01 -0800

Hello,

syzbot tried to test the proposed patch but build/boot failed:

is larger than 2048 bytes [-Wframe-larger-than=]
  }
  ^
   CC      net/netfilter/xt_CLASSIFY.o
   CC      drivers/tty/vt/vc_screen.o
   CC      drivers/tty/vt/selection.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_scl_filters.o
   CC      net/netfilter/xt_CONNSECMARK.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.o
   CC      drivers/tty/vt/keyboard.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_clocks.o
   AR      drivers/virtio/virtio_pci.o
   AR      drivers/tty/serdev/serdev.o
   AR      drivers/tty/serdev/built-in.o
   CC      drivers/tty/vt/consolemap.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_opp.o
   CC      drivers/tty/serial/8250/8250_pnp.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_dmcu.o
   CC      drivers/video/fbdev/xen-fbfront.o
   CC      net/netfilter/xt_CT.o
   AR      drivers/virtio/built-in.o
   CC      drivers/video/fbdev/core/fbsysfs.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_abm.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_ipp.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_base.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.o
   CC      drivers/tty/serial/8250/8250_port.o
   CC      drivers/tty/serial/8250/8250_dma.o
   CC      drivers/tty/serial/8250/8250_pci.o
   CC      drivers/tty/vt/consolemap_deftbl.o
   CC      drivers/video/fbdev/core/modedb.o
   CC      drivers/video/fbdev/core/fbcvt.o
   CC      drivers/video/fbdev/core/fb_defio.o
   CC      drivers/video/fbdev/core/fbcon.o
   CC      drivers/tty/serial/8250/8250_early.o
   CC      drivers/xen/cpu_hotplug.o
   CC      net/netfilter/xt_DSCP.o
   CC      drivers/xen/fallback.o
   CC      drivers/xen/grant-table.o
   CC      drivers/xen/features.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_factory.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_gpio.o
   CC      drivers/video/fbdev/core/bitblit.o
   AR      drivers/usb/core/usbcore.o
   AR      drivers/usb/core/built-in.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_hpd.o
   CC      drivers/xen/balloon.o
   CC      drivers/tty/serial/8250/8250_lpss.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_ddc.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_translate.o
   CC      drivers/tty/vt/vt.o
   CC      net/netfilter/xt_HL.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/dce80/hw_translate_dce80.o
   CC      drivers/xen/manage.o
   CC      drivers/video/fbdev/core/softcursor.o
   CC      drivers/xen/preempt.o
   CC      net/netfilter/xt_HMARK.o
   CC      drivers/usb/mon/mon_main.o
   CC      drivers/tty/serial/8250/8250_mid.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/dce80/hw_factory_dce80.o
   CC      drivers/video/fbdev/core/tileblit.o
   CC      drivers/video/fbdev/core/cfbfillrect.o
   CC      drivers/video/fbdev/core/cfbcopyarea.o
   CC      drivers/xen/time.o
   CC      net/netfilter/xt_LED.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/dce110/hw_translate_dce110.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/dce110/hw_factory_dce110.o
   AR      drivers/usb/host/built-in.o
   CC      drivers/video/fbdev/core/cfbimgblt.o
   AR      drivers/tty/serial/8250/8250.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/dce120/hw_translate_dce120.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/dce120/hw_factory_dce120.o
   CC      drivers/video/fbdev/core/sysfillrect.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/diagnostics/hw_translate_diag.o
   CC      drivers/xen/events/events_base.o
   CC      drivers/video/fbdev/efifb.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/diagnostics/hw_factory_diag.o
   CC      drivers/xen/xen-pciback/pci_stub.o
   CC      drivers/xen/events/events_2l.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/aux_engine.o
   CC      drivers/usb/mon/mon_stat.o
   CC      drivers/video/fbdev/core/syscopyarea.o
   CC      drivers/xen/xenbus/xenbus_client.o
   CC      drivers/xen/xenbus/xenbus_comms.o
   CC      drivers/xen/xenbus/xenbus_xs.o
   CC      drivers/xen/xenbus/xenbus_probe.o
   CC      drivers/video/fbdev/core/sysimgblt.o
   CC      drivers/video/fbdev/core/fb_sys_fops.o
   CC      drivers/xen/xenfs/super.o
   CC      drivers/xen/xenfs/xenstored.o
   CC      drivers/xen/xenfs/xensyms.o
   CC      drivers/xen/pci.o
   CC      drivers/xen/dbgp.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/engine_base.o
   CC      drivers/xen/acpi.o
   CC      net/netfilter/xt_LOG.o
   CC      drivers/xen/xen-acpi-pad.o
   CC      net/netfilter/xt_NETMAP.o
   CC      drivers/usb/mon/mon_text.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/i2caux.o
   CC      drivers/xen/xenbus/xenbus_probe_backend.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/i2c_engine.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/i2c_generic_hw_engine.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/i2c_hw_engine.o
   CC      drivers/xen/events/events_fifo.o
   CC      drivers/xen/xenbus/xenbus_dev_frontend.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/i2c_sw_engine.o
   CC      drivers/xen/xenbus/xenbus_dev_backend.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce80/i2caux_dce80.o
   AR      drivers/tty/serial/8250/8250_base.o
   AR      drivers/tty/serial/8250/built-in.o
   CC      drivers/xen/xenbus/xenbus_probe_frontend.o
   AR      drivers/tty/serial/built-in.o
   CC      drivers/xen/pcpu.o
   CC      drivers/xen/biomerge.o
   AR      drivers/xen/xenfs/xenfs.o
   AR      drivers/xen/xenfs/built-in.o
   CC      drivers/xen/xen-balloon.o
   CC      drivers/xen/xen-pciback/pciback_ops.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce80/i2c_hw_engine_dce80.o
   CC      drivers/xen/evtchn.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce80/i2c_sw_engine_dce80.o
   CC      drivers/xen/xen-pciback/xenbus.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce100/i2caux_dce100.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/i2caux_dce110.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/i2c_sw_engine_dce110.o
   CC      drivers/xen/xen-pciback/conf_space.o
   CC      drivers/tty/vt/defkeymap.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/i2c_hw_engine_dce110.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce112/i2caux_dce112.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce120/i2caux_dce120.o
   CC      net/netfilter/xt_NFLOG.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/diagnostics/i2caux_diag.o
   CC      drivers/xen/gntdev.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/irq/irq_service.o
   CC      drivers/xen/gntalloc.o
   CC      net/netfilter/xt_NFQUEUE.o
   CC      drivers/xen/sys-hypervisor.o
   CC      drivers/xen/platform-pci.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dce80/irq_service_dce80.o
   AR      drivers/xen/xenbus/xenbus.o
   CC      drivers/usb/mon/mon_bin.o
   CC      net/netfilter/xt_RATEEST.o
   CC      drivers/xen/swiotlb-xen.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dce110/irq_service_dce110.o
   AR      drivers/xen/events/events.o
   AR      drivers/xen/events/built-in.o
   CC      drivers/xen/mcelog.o
   AR      drivers/xen/xenbus/built-in.o
   CC      drivers/xen/privcmd.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dce120/irq_service_dce120.o
   CC      drivers/usb/typec/typec.o
   CC      drivers/usb/storage/scsiglue.o
   CC      drivers/usb/typec/tcpm.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/virtual/virtual_link_encoder.o
   CC      drivers/xen/xen-pciback/conf_space_header.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/virtual/virtual_stream_encoder.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce120/dce120_resource.o
   CC      drivers/xen/xen-pciback/conf_space_capability.o
   CC      drivers/usb/storage/protocol.o
   CC      net/netfilter/xt_REDIRECT.o
   CC      drivers/usb/typec/ucsi/ucsi.o
   CC      net/netfilter/xt_SECMARK.o
   CC      drivers/xen/xen-pciback/conf_space_quirks.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce120/dce120_timing_generator.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce120/dce120_hw_sequencer.o
   CC      drivers/usb/storage/transport.o
   CC      drivers/xen/xen-acpi-processor.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce112/dce112_compressor.o
   CC      drivers/xen/efi.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce112/dce112_hw_sequencer.o
   CC      net/netfilter/xt_TPROXY.o
   CC      drivers/xen/xlate_mmu.o
   CC      net/netfilter/xt_TCPMSS.o
   CC      drivers/usb/typec/ucsi/trace.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce112/dce112_resource.o
   CC      drivers/xen/xen-pciback/vpci.o
   CC      drivers/usb/storage/usb.o
   CC      drivers/xen/xen-pciback/passthrough.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_timing_generator.o
   CC      drivers/xen/pvcalls-back.o
   CC      drivers/xen/pvcalls-front.o
   CC      drivers/usb/storage/initializers.o
   AR      drivers/video/fbdev/core/fb.o
   AR      drivers/video/fbdev/core/built-in.o
   AR      drivers/video/fbdev/built-in.o
   CC      drivers/usb/storage/sierra_ms.o
   AR      drivers/video/built-in.o
   CC      drivers/usb/storage/option_ms.o
   CC      drivers/usb/storage/usual-tables.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_compressor.o
   CC      net/netfilter/xt_TCPOPTSTRIP.o
   AR      drivers/usb/mon/usbmon.o
   AR      drivers/usb/mon/built-in.o
   CC      net/netfilter/xt_TEE.o
   AR      drivers/xen/xen-evtchn.o
   AR      drivers/xen/xen-gntalloc.o
   AR      drivers/xen/xen-privcmd.o
   CC      drivers/usb/typec/ucsi/ucsi_acpi.o
   AR      drivers/xen/xen-gntdev.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_resource.o
   CC      net/netfilter/xt_TRACE.o
   CC      net/netfilter/xt_IDLETIMER.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_opp_regamma_v.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_opp_csc_v.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_timing_generator_v.o
   CC      net/netfilter/xt_addrtype.o
   CC      net/netfilter/xt_bpf.o
   AR      drivers/xen/xen-pciback/xen-pciback.o
   AR      drivers/xen/xen-pciback/built-in.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_mem_input_v.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_opp_v.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_transform_v.o
   CC      net/netfilter/xt_cluster.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce100/dce100_resource.o
   AR      drivers/usb/typec/ucsi/typec_ucsi.o
   CC      net/netfilter/xt_comment.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce100/dce100_hw_sequencer.o
   CC      net/netfilter/xt_connbytes.o
   AR      drivers/usb/typec/ucsi/built-in.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_timing_generator.o
   CC      net/netfilter/xt_connlabel.o
   AR      drivers/tty/vt/built-in.o
   AR      drivers/tty/built-in.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_compressor.o
   CC       
drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_hw_sequencer.o
   AR      drivers/usb/storage/usb-storage.o
   AR      drivers/usb/storage/built-in.o
   CC      net/netfilter/xt_connlimit.o
   CC      net/netfilter/xt_conntrack.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dce80/dce80_resource.o
   CC      net/netfilter/xt_cpu.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.o
   CC      net/netfilter/xt_dccp.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.o
   CC      net/netfilter/xt_devgroup.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_hw_sequencer.o
   CC      net/netfilter/xt_dscp.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_sink.o
   CC      net/netfilter/xt_ecn.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_surface.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_hwss.o
   CC      net/netfilter/xt_esp.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.o
   CC      net/netfilter/xt_hashlimit.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_ddc.o
   CC      net/netfilter/xt_helper.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_debug.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/dc/dc_helper.o
   CC      drivers/gpu/drm/amd/amdgpu/../display/modules/freesync/freesync.o
   CC      net/netfilter/xt_hl.o
   CC      net/netfilter/xt_ipcomp.o
   CC      net/netfilter/xt_iprange.o
   CC      net/netfilter/xt_ipvs.o
   CC      net/netfilter/xt_l2tp.o
   CC      net/netfilter/xt_length.o
   AR      drivers/xen/built-in.o
   CC      net/netfilter/xt_limit.o
   CC      net/netfilter/xt_mac.o
   CC      net/netfilter/xt_multiport.o
   CC      net/netfilter/xt_osf.o
   CC      net/netfilter/xt_nfacct.o
   CC      net/netfilter/xt_owner.o
   CC      net/netfilter/xt_cgroup.o
   CC      net/netfilter/xt_physdev.o
   CC      net/netfilter/xt_pkttype.o
   CC      net/netfilter/xt_policy.o
   CC      net/netfilter/xt_quota.o
   CC      net/netfilter/xt_rateest.o
   CC      net/netfilter/xt_realm.o
   CC      net/netfilter/xt_recent.o
   CC      net/netfilter/xt_sctp.o
   CC      net/netfilter/xt_socket.o
   CC      net/netfilter/xt_state.o
   CC      net/netfilter/xt_statistic.o
   CC      net/netfilter/xt_string.o
   CC      net/netfilter/xt_tcpmss.o
   CC      net/netfilter/xt_time.o
   CC      net/netfilter/xt_u32.o
   AR      drivers/usb/typec/built-in.o
   AR      drivers/usb/built-in.o
   AR      net/netfilter/netfilter.o
   AR      net/netfilter/nf_conntrack.o
   AR      net/netfilter/nf_conntrack_h323.o
   AR      net/netfilter/nf_nat.o
   AR      net/netfilter/nf_tables.o
   CC      net/netfilter/ipset/ip_set_core.o
   CC      net/netfilter/ipvs/ip_vs_conn.o
   CC      net/netfilter/ipset/ip_set_getport.o
   CC      net/netfilter/ipvs/ip_vs_core.o
   CC      net/netfilter/ipset/pfxlen.o
   CC      net/netfilter/ipvs/ip_vs_ctl.o
   CC      net/netfilter/ipset/ip_set_bitmap_ip.o
   CC      net/netfilter/ipset/ip_set_bitmap_ipmac.o
   CC      net/netfilter/ipvs/ip_vs_sched.o
   CC      net/netfilter/ipset/ip_set_bitmap_port.o
   CC      net/netfilter/ipvs/ip_vs_xmit.o
   CC      net/netfilter/ipset/ip_set_hash_ip.o
   CC      net/netfilter/ipvs/ip_vs_app.o
   CC      net/netfilter/ipvs/ip_vs_sync.o
   CC      net/netfilter/ipvs/ip_vs_est.o
   CC      net/netfilter/ipvs/ip_vs_proto.o
   CC      net/netfilter/ipset/ip_set_hash_ipmac.o
   CC      net/netfilter/ipset/ip_set_hash_ipmark.o
   CC      net/netfilter/ipset/ip_set_hash_ipport.o
   CC      net/netfilter/ipvs/ip_vs_pe.o
   CC      net/netfilter/ipset/ip_set_hash_ipportip.o
   CC      net/netfilter/ipvs/ip_vs_proto_tcp.o
   CC      net/netfilter/ipset/ip_set_hash_ipportnet.o
   CC      net/netfilter/ipvs/ip_vs_proto_udp.o
   CC      net/netfilter/ipset/ip_set_hash_mac.o
   CC      net/netfilter/ipset/ip_set_hash_net.o
   CC      net/netfilter/ipvs/ip_vs_proto_ah_esp.o
   CC      net/netfilter/ipvs/ip_vs_proto_sctp.o
   CC      net/netfilter/ipset/ip_set_hash_netport.o
   CC      net/netfilter/ipvs/ip_vs_nfct.o
   CC      net/netfilter/ipset/ip_set_hash_netiface.o
   CC      net/netfilter/ipvs/ip_vs_wlc.o
   CC      net/netfilter/ipset/ip_set_hash_netnet.o
   CC      net/netfilter/ipset/ip_set_hash_netportnet.o
   CC      net/netfilter/ipvs/ip_vs_ftp.o
   CC      net/netfilter/ipvs/ip_vs_pe_sip.o
   CC      net/netfilter/ipset/ip_set_list_set.o
   AR      net/netfilter/ipset/ip_set.o
   AR      drivers/gpu/drm/amd/amdgpu/amdgpu.o
   AR      drivers/gpu/drm/amd/amdgpu/built-in.o
   AR      drivers/gpu/drm/built-in.o
   AR      drivers/gpu/built-in.o
   AR      drivers/built-in.o
   AR      net/netfilter/ipvs/ip_vs.o
   AR      net/netfilter/ipvs/built-in.o
   AR      net/netfilter/ipset/built-in.o
   AR      net/netfilter/built-in.o
Makefile:1020: recipe for target 'net' failed
make: *** [net] Error 2

Error text is too large and was truncated, full error text is attached.

Tested on net commit
176bfb406d735655f9a69d868a7af0c3da959d51 (Tue Feb 6 16:48:40 2018 +0000)
Merge branch 'be2net-patch-set'

compiler: gcc (GCC) 7.1.1 20170620
Patch is attached.

--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -230,17 +230,6 @@ clusterip_config_init(struct net *net, const struct ipt_clusterip_tgt_info *i,
 	refcount_set(&c->refcount, 1);
 	refcount_set(&c->entries, 1);
 
-	spin_lock_bh(&cn->lock);
-	if (__clusterip_config_find(net, ip)) {
-		spin_unlock_bh(&cn->lock);
-		kfree(c);
-
-		return ERR_PTR(-EBUSY);
-	}
-
-	list_add_rcu(&c->list, &cn->configs);
-	spin_unlock_bh(&cn->lock);
-
 #ifdef CONFIG_PROC_FS
 	{
 		char buffer[16];
@@ -257,20 +246,31 @@ clusterip_config_init(struct net *net, const struct ipt_clusterip_tgt_info *i,
 	}
 #endif
 
+	spin_lock_bh(&cn->lock);
+	if (__clusterip_config_find(net, ip)) {
+		spin_unlock_bh(&cn->lock);
+		err = -EBUSY;
+		goto err_remove_pte:
+	}
+
+	list_add_rcu(&c->list, &cn->configs);
+	spin_unlock_bh(&cn->lock);
+
 	c->notifier.notifier_call = clusterip_netdev_event;
 	err = register_netdevice_notifier(&c->notifier);
 	if (!err)
 		return c;
 
+	spin_lock_bh(&cn->lock);
+	list_del_rcu(&c->list);
+	spin_unlock_bh(&cn->lock);
+
+err_remove_pte:
 #ifdef CONFIG_PROC_FS
 	proc_remove(c->pde);
 err:
 #endif
-	spin_lock_bh(&cn->lock);
-	list_del_rcu(&c->list);
-	spin_unlock_bh(&cn->lock);
 	kfree(c);
-
 	return ERR_PTR(err);
 }