diff --git a/net/can/bcm.c b/net/can/bcm.c index 2388c619f29ca85c1e4f5a15dca7c230e547cdba..cb849b5a8c14d2edf755c44d30a897a54a88c7b8 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -1423,6 +1423,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;