OK bluhm@

On Mon, Oct 26, 2015 at 05:24:19PM +0100, Martin Pieuchot wrote:
> Index: net/if.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if.c,v
> retrieving revision 1.398
> diff -u -p -r1.398 if.c
> --- net/if.c  25 Oct 2015 21:58:04 -0000      1.398
> +++ net/if.c  26 Oct 2015 16:02:06 -0000
> @@ -2341,6 +2341,7 @@ if_group_routechange(struct sockaddr *ds
>  int
>  if_group_egress_build(void)
>  {
> +     struct ifnet            *ifp;
>       struct ifg_group        *ifg;
>       struct ifg_member       *ifgm, *next;
>       struct sockaddr_in       sa_in;
> @@ -2364,8 +2365,11 @@ if_group_egress_build(void)
>       if (rt0 != NULL) {
>               rt = rt0;
>               do {
> -                     if (rt->rt_ifp)
> -                             if_addgroup(rt->rt_ifp, IFG_EGRESS);
> +                     ifp = if_get(rt->rt_ifidx);
> +                     if (ifp != NULL) {
> +                             if_addgroup(ifp, IFG_EGRESS);
> +                             if_put(ifp);
> +                     }
>  #ifndef SMALL_KERNEL
>                       rt = rt_mpath_next(rt);
>  #else
> @@ -2381,8 +2385,11 @@ if_group_egress_build(void)
>       if (rt0 != NULL) {
>               rt = rt0;
>               do {
> -                     if (rt->rt_ifp)
> -                             if_addgroup(rt->rt_ifp, IFG_EGRESS);
> +                     ifp = if_get(rt->rt_ifidx);
> +                     if (ifp != NULL) {
> +                             if_addgroup(ifp, IFG_EGRESS);
> +                             if_put(ifp);
> +                     }
>  #ifndef SMALL_KERNEL
>                       rt = rt_mpath_next(rt);
>  #else
> Index: net/pf.c
> ===================================================================
> RCS file: /cvs/src/sys/net/pf.c,v
> retrieving revision 1.947
> diff -u -p -r1.947 pf.c
> --- net/pf.c  13 Oct 2015 19:32:31 -0000      1.947
> +++ net/pf.c  26 Oct 2015 16:03:57 -0000
> @@ -2912,6 +2912,7 @@ pf_get_mss(struct pf_pdesc *pd)
>  u_int16_t
>  pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t 
> offer)
>  {
> +     struct ifnet            *ifp;
>       struct sockaddr_in      *dst;
>  #ifdef INET6
>       struct sockaddr_in6     *dst6;
> @@ -2944,11 +2945,12 @@ pf_calc_mss(struct pf_addr *addr, sa_fam
>  #endif /* INET6 */
>       }
>  
> -     if (rt && rt->rt_ifp) {
> -             mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr);
> +     if (rt != NULL && (ifp = if_get(rt->rt_ifidx)) != NULL) {
> +             mss = ifp->if_mtu - hlen - sizeof(struct tcphdr);
>               mss = max(tcp_mssdflt, mss);
> -             rtfree(rt);
> +             if_put(ifp);
>       }
> +     rtfree(rt);
>       mss = min(mss, offer);
>       mss = max(mss, 64);             /* sanity - at least max opt space */
>       return (mss);
> Index: netinet6/nd6.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/nd6.c,v
> retrieving revision 1.162
> diff -u -p -r1.162 nd6.c
> --- netinet6/nd6.c    25 Oct 2015 15:11:52 -0000      1.162
> +++ netinet6/nd6.c    26 Oct 2015 16:23:23 -0000
> @@ -392,8 +392,8 @@ nd6_llinfo_timer(void *arg)
>  
>       if ((rt = ln->ln_rt) == NULL)
>               panic("ln->ln_rt == NULL");
> -     if ((ifp = rt->rt_ifp) == NULL)
> -             panic("ln->ln_rt->rt_ifp == NULL");
> +     if ((ifp = if_get(rt->rt_ifidx)) == NULL)
> +             return;
>       ndi = ND_IFINFO(ifp);
>       dst = satosin6(rt_key(rt));
>  
> @@ -477,6 +477,7 @@ nd6_llinfo_timer(void *arg)
>               break;
>       }
>  
> +     if_put(ifp);
>       splx(s);
>  }
>  

Reply via email to