# Re: \[RFC 2.6.10 7/22\] xfrm: Allow device drivers to force recalculation of offloads

- From: David Dillow \<dave@thedillows.org\>
- Date: 2005-01-22 05:53:36 
- List: netdev
- Page: https://ratatoskr.run/netdev/2005/01/10748412
- Thread: https://ratatoskr.run/netdev/2004/12/698207/t.md

```text
On Fri, 2005-01-21 at 15:23 -0800, David S. Miller wrote: 
> On Thu, 30 Dec 2004 03:48:35 -0500
> David Dillow [ref] wrote:
> 
> > # This is a BitKeeper generated diff -Nru style patch.
> > #
> > # ChangeSet
> > #   2004/12/30 00:37:44-05:00 dave@thedillows.org 
> > #   Give device drivers a method to allow the use of crypto
> > #   offload features for existing xfrm_states and bundles, as
> > #   well as dynamically remove crypto offload capabilities.
> > #   
> > #   Signed-off-by: David Dillow [ref]
> 
> This change looks fine, but it reminds me of something.
> 
> We have to make sure there is no way for xfrm_offloads to
> refer to a device when it is brought down.
> 
> One way to ensure that, is to make each xfrm_offload attached
> grab a reference to the device it is for.  The refcounting will
> help catch cases where stale xfrm_offload are around at
> unregister_netdev() time.

You're right, it would be a problem, and I have the oopsen to prove
it. :)

In patch 3 of the series, xfrm_offload_add() grabs a reference to the
device, and xfrm_offload_release() releases it when the offload's own
reference count hits zero.
-- 
David Dillow [ref]
```
