diff --git a/net/can/bcm.c b/net/can/bcm.c index 9168114fc87f7b577d393fda08a80d7a9941122e..a1f5db0fd5d4fd1debb8175dbf6cca38183891df 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -1428,6 +1428,12 @@ static void bcm_notify(struct bcm_sock *bo, unsigned long msg, /* remove device reference, if this is our bound device */ if (bo->bound && bo->ifindex == dev->ifindex) { +#if IS_ENABLED(CONFIG_PROC_FS) + if (sock_net(sk)->can.bcmproc_dir && bo->bcm_proc_read) { + remove_proc_entry(bo->procname, sock_net(sk)->can.bcmproc_dir); + bo->bcm_proc_read = NULL; + } +#endif bo->bound = 0; bo->ifindex = 0; notify_enodev = 1;