Re: Backtrace of pfinet crashing

Samuel Thibault <[email protected]> Thu, 16 Jul 2026 01:23:22 +0200
Newsgroups gmane.linux.debian.ports.hurd
Organization I am not organized
Message-ID <algWaqj87X4irIqy@end>
--oF8Hf3dtODPQYVV/
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

João Pedro Malhado, le mer. 15 juil. 2026 23:51:32 +0100, a ecrit:
> On Wed, Jul 15, 2026 at 12:48:27AM +0200, Samuel Thibault wrote:
> > João Pedro Malhado, le mar. 14 juil. 2026 10:28:24 +0100, a ecrit:
> > > I have tried it on another Toshiba netbook, now with driver r8169, and every
> > > other time I try to bring up the interface using DHCP I get pfinet crashing.
> > > It says it creates a core dump file, but I am unable to find one.
> > 
> > You can as well just attach a gdb to get to observe the crash.
> 
> I attach the backtrace of pfinet crashing when trying to bring up the device.
> 
> parse_interface_copy_device (src=<optimized out>, dst=<optimized out>) at ../../pfinet/options.c:157
> warning: 157	../../pfinet/options.c: No such file or directory
> #0  parse_interface_copy_device (src=<optimized out>, dst=<optimized out>) at ../../pfinet/options.c:157

Ah, that loop is bogus when idev->addr_list is NULL, indeed. I have
applied the attached patch.

Samuel

--oF8Hf3dtODPQYVV/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

commit a722d97d341883111c8b65e50a658d5632b493a6
Author: Samuel Thibault <[email protected]>
Date:   Thu Jul 16 01:20:36 2026 +0200

    pfinet: Fix crash on missing address on interface
    
    In case idev->addr_list is NULL

diff --git a/pfinet/options.c b/pfinet/options.c
index fd88ea6ba..5bb822531 100644
--- a/pfinet/options.c
+++ b/pfinet/options.c
@@ -143,7 +143,7 @@ parse_interface_copy_device(struct device *src,
 
   if (idev)
     {
-      struct inet6_ifaddr *ifa = idev->addr_list;
+      struct inet6_ifaddr *ifa;
 
       /* Look for IPv6 default router and add it to the interface,
        * if it belongs to it.
@@ -151,8 +151,9 @@ parse_interface_copy_device(struct device *src,
       struct rt6_info *rt6i = ipv6_get_dflt_router();
       if (rt6i->rt6i_dev == src)
 	memcpy (&dst->gateway6, &rt6i->rt6i_gateway, sizeof (struct in6_addr));
+
       /* Search for global address and set it in dst */
-      do
+      for (ifa = idev->addr_list; ifa; ifa = ifa->if_next)
 	{
 	  if (!IN6_IS_ADDR_LINKLOCAL (&ifa->addr))
 	    {
@@ -160,7 +161,6 @@ parse_interface_copy_device(struct device *src,
 	      break;
 	    }
 	}
-      while ((ifa = ifa->if_next));
     }
 #endif
 }

--oF8Hf3dtODPQYVV/--