diff --git a/net/can/bcm.c b/net/can/bcm.c index afa82adaf6cd5a8f79c1588b87ad18d30d09f240..32c8c5ce1b4d088f375195ee37f257dc30ef9670 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -1419,6 +1419,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;