Hi Alex, On 16/09/14 21:07, Alexander Aring wrote: > On Tue, Sep 16, 2014 at 08:53:06PM +0100, Martin Townsend wrote: > ... >>> I make another c example, hopeful more correct than the last one: >>> >>> char *foo(char *skb) >>> { >>> char *new; >>> >>> if (some_error_before_consume) >>> return ERR_PTR(-EINVAL); /* here we need to do a free(skb) >>> */ >>> >>> /* UDP expand */ >>> new = expand(skb, 16); > s/16/8 , argl, doesn't matter was only an example. :-) > >>> if (!new) >>> return ERR_PTR(-ENOMEM); >>> consume(skb); /* parameter skb becomes dangling pointer */ >>> skb = new; /* doesn't rescue it, it is different than skb from >>> caller function >>> at this point, the skb_inout had rescue it, because >>> it was a pointer >>> of pointer */ >>> >>> /* IPv6 expand */ >>> new = expand(skb, 40); >>> if (!new) /* some error after a consume(skb), will crash at >>> drop_skb label */ >>> return ERR_PTR(-ENOMEM); >>> consume(skb); >>> skb = new; >>> >>> return skb; >>> } >> I see the problem now, once the skb has been copied and then an error occurs >> you have to return the error and the skb has been lost. Would using the >> skb->cb to store decompress status get around this problem? > mhhh, complicated... on 802.15.4 6LoWPAN we use the control block > information for fragmentation information. I don't know right now if we > get trouble when we add the "uncompression on the fly when FRAG1 was > received". > > What exactly do you mean with "decompress status"? An integer that either contains an error code or 0 that process_data would set as process_data is now IPHC decompression. > - Alex - Martin.
------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce. Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel