[OpenWrt-Devel] [RFC netifd] Out-of-sync reference counter causes seg. fault

Felix Fietkau nbd at openwrt.org
Sun Jun 29 14:36:26 EDT 2014


On 2014-06-18 18:12, Kristian Evensen wrote:
> From: Kristian Evensen <kristian.evensen at gmail.com>
> 
> Hello,
> 
> I have written a small tool which automatically adds/removes a usb LAN dongle
> from uci. When the USB device is inserted, I add entries to UCI (using libuci)
> and do network reload (using libubus). When the device is removed, I remove the
> UCI-entries and do reload again.
> 
> This all works fine. However, when I connect the device a second time, netifd
> crashes with a seg. fault. The problem seems to be that the reference counter is
> not reduced properly when device remove, and device is not properly removed from
> internal data structures.
> 
> The missing reference counter update seems to be in device_release(). After
> adding a call to device_remove_user() here, the reference counter is correct,
> device is correctly removed and netifd is stable. I have also tested by
> adding/removing other types of network devices, and netifd seems to work fine.
> 
> However, I am not familiar enough with the internal architecture of netifd to
> know if this is a correct fix or just a dirty hack. If this is a hack, does
> anyone have any feedback or hints to how I can properly solve this issue?
Please test the latest version and check if that hack is still necessary.

Thanks,

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list