diff options
Diffstat (limited to 'net/netlabel/netlabel_mgmt.c')
-rw-r--r-- | net/netlabel/netlabel_mgmt.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index 44be5d5261f4..c4e18c7bc0c1 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -122,18 +122,12 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info) | |||
122 | goto add_failure; | 122 | goto add_failure; |
123 | 123 | ||
124 | tmp_val = nla_get_u32(info->attrs[NLBL_MGMT_A_CV4DOI]); | 124 | tmp_val = nla_get_u32(info->attrs[NLBL_MGMT_A_CV4DOI]); |
125 | /* We should be holding a rcu_read_lock() here while we hold | ||
126 | * the result but since the entry will always be deleted when | ||
127 | * the CIPSO DOI is deleted we aren't going to keep the | ||
128 | * lock. */ | ||
129 | rcu_read_lock(); | ||
130 | entry->type_def.cipsov4 = cipso_v4_doi_getdef(tmp_val); | 125 | entry->type_def.cipsov4 = cipso_v4_doi_getdef(tmp_val); |
131 | if (entry->type_def.cipsov4 == NULL) { | 126 | if (entry->type_def.cipsov4 == NULL) |
132 | rcu_read_unlock(); | ||
133 | goto add_failure; | 127 | goto add_failure; |
134 | } | ||
135 | ret_val = netlbl_domhsh_add(entry, &audit_info); | 128 | ret_val = netlbl_domhsh_add(entry, &audit_info); |
136 | rcu_read_unlock(); | 129 | if (ret_val != 0) |
130 | cipso_v4_doi_putdef(entry->type_def.cipsov4); | ||
137 | break; | 131 | break; |
138 | default: | 132 | default: |
139 | goto add_failure; | 133 | goto add_failure; |
@@ -294,18 +288,12 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info) | |||
294 | goto adddef_failure; | 288 | goto adddef_failure; |
295 | 289 | ||
296 | tmp_val = nla_get_u32(info->attrs[NLBL_MGMT_A_CV4DOI]); | 290 | tmp_val = nla_get_u32(info->attrs[NLBL_MGMT_A_CV4DOI]); |
297 | /* We should be holding a rcu_read_lock() here while we hold | ||
298 | * the result but since the entry will always be deleted when | ||
299 | * the CIPSO DOI is deleted we aren't going to keep the | ||
300 | * lock. */ | ||
301 | rcu_read_lock(); | ||
302 | entry->type_def.cipsov4 = cipso_v4_doi_getdef(tmp_val); | 291 | entry->type_def.cipsov4 = cipso_v4_doi_getdef(tmp_val); |
303 | if (entry->type_def.cipsov4 == NULL) { | 292 | if (entry->type_def.cipsov4 == NULL) |
304 | rcu_read_unlock(); | ||
305 | goto adddef_failure; | 293 | goto adddef_failure; |
306 | } | ||
307 | ret_val = netlbl_domhsh_add_default(entry, &audit_info); | 294 | ret_val = netlbl_domhsh_add_default(entry, &audit_info); |
308 | rcu_read_unlock(); | 295 | if (ret_val != 0) |
296 | cipso_v4_doi_putdef(entry->type_def.cipsov4); | ||
309 | break; | 297 | break; |
310 | default: | 298 | default: |
311 | goto adddef_failure; | 299 | goto adddef_failure; |