Re: git: 889c60500d30 - main - ip_mroute: release epoch lock if mrouter is not configured

From: Kristof Provost <kp_at_freebsd.org>
Date: Sat, 22 Jan 2022 13:35:28 UTC
I think there’s an early return in ip_mroiter_done() that doesn’t unlock as well. 

I’m also unsure if epoch provides the protection you’re looking for. 

Kristof
(On mobile, so short and no code pointers)

> On 22 Jan 2022, at 11:49, Wojciech Macek <wma@freebsd.org> wrote:
> 
> The branch main has been updated by wma:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=889c60500d30c8fd3cbf597fd73d5cd90f5fc7e7
> 
> commit 889c60500d30c8fd3cbf597fd73d5cd90f5fc7e7
> Author:     Wojciech Macek <wma@FreeBSD.org>
> AuthorDate: 2022-01-22 10:47:39 +0000
> Commit:     Wojciech Macek <wma@FreeBSD.org>
> CommitDate: 2022-01-22 10:48:30 +0000
> 
>    ip_mroute: release epoch lock if mrouter is not configured
> 
>    Add mising "else" branch to release a lock if mrouter is not
>    configured.
> 
>    Obtained from:          Semihalf
>    Sponsored by:           Stormshield
> ---
> sys/netinet/raw_ip.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
> index 08ce848a63f7..229716918875 100644
> --- a/sys/netinet/raw_ip.c
> +++ b/sys/netinet/raw_ip.c
> @@ -890,6 +890,8 @@ rip_detach(struct socket *so)
>    MROUTER_RLOCK();
>    if (so == V_ip_mrouter && ip_mrouter_done)
>        ip_mrouter_done(MROUTER_RLOCK_PARAM_PTR);
> +    else
> +        MROUTER_RUNLOCK();
> 
>    INP_WLOCK(inp);
>    INP_HASH_WLOCK(&V_ripcbinfo);
>