Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177870021
D61899.1795475978.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61899.1795475978.diff
View Options
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -5428,9 +5428,18 @@
/* Clone SA's content into newsav */
SAV_INITREF(newsav);
bcopy(sav, newsav, offsetof(struct secasvar, chain));
+ /*
+ * The copy still points at the old SA's NAT-T config and offload
+ * interface name. Those stay with the old SA, and key_cleansav()
+ * frees them with its last reference. Clear them before anything
+ * can fail, so that the error path frees only what belongs to
+ * newsav.
+ */
+ newsav->natt = NULL;
#ifdef IPSEC_OFFLOAD
CK_LIST_INIT(&newsav->accel_ifps);
newsav->accel_forget_tq = 0;
+ newsav->accel_ifname = NULL;
newsav->accel_lft_sw = uma_zalloc_pcpu(ipsec_key_lft_zone,
M_NOWAIT | M_ZERO);
if (newsav->accel_lft_sw == NULL) {
@@ -5446,20 +5455,15 @@
error = ENOBUFS;
goto fail;
}
- strncpy(__DECONST(char *, sav->accel_ifname),
- newsav->accel_ifname,
+ strncpy(__DECONST(char *, newsav->accel_ifname),
+ sav->accel_ifname,
sizeof(xof.sadb_x_if_hw_offl_if));
}
#endif
- /*
- * We create new NAT-T config if it is needed.
- * Old NAT-T config will be freed by key_cleansav() when
- * last reference to SA will be released.
- */
- newsav->natt = NULL;
newsav->sah = sah;
newsav->state = SADB_SASTATE_MATURE;
+ /* Create a new NAT-T config if one is needed. */
error = key_setnatt(newsav, mhp);
if (error != 0)
goto fail;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 23, 11:19 PM (21 h, 1 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41921613
Default Alt Text
D61899.1795475978.diff (1 KB)
Attached To
Mode
D61899: netipsec: Copy the offload interface name to a cloned SA
Attached
Detach File
Event Timeline