@@ -1146,7 +1146,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
11461146 return ERR_PTR (- ENOMEM );
11471147
11481148 if (!cda [CTA_TIMEOUT ])
1149- goto err ;
1149+ goto err1 ;
11501150 ct -> timeout .expires = ntohl (nla_get_be32 (cda [CTA_TIMEOUT ]));
11511151
11521152 ct -> timeout .expires = jiffies + ct -> timeout .expires * HZ ;
@@ -1157,39 +1157,35 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
11571157 char * helpname ;
11581158
11591159 err = ctnetlink_parse_help (cda [CTA_HELP ], & helpname );
1160- if (err < 0 ) {
1161- rcu_read_unlock ();
1162- goto err ;
1163- }
1160+ if (err < 0 )
1161+ goto err2 ;
11641162
11651163 helper = __nf_conntrack_helper_find_byname (helpname );
11661164 if (helper == NULL ) {
11671165 rcu_read_unlock ();
11681166#ifdef CONFIG_MODULES
11691167 if (request_module ("nfct-helper-%s" , helpname ) < 0 ) {
11701168 err = - EOPNOTSUPP ;
1171- goto err ;
1169+ goto err1 ;
11721170 }
11731171
11741172 rcu_read_lock ();
11751173 helper = __nf_conntrack_helper_find_byname (helpname );
11761174 if (helper ) {
1177- rcu_read_unlock ();
11781175 err = - EAGAIN ;
1179- goto err ;
1176+ goto err2 ;
11801177 }
11811178 rcu_read_unlock ();
11821179#endif
11831180 err = - EOPNOTSUPP ;
1184- goto err ;
1181+ goto err1 ;
11851182 } else {
11861183 struct nf_conn_help * help ;
11871184
11881185 help = nf_ct_helper_ext_add (ct , GFP_ATOMIC );
11891186 if (help == NULL ) {
1190- rcu_read_unlock ();
11911187 err = - ENOMEM ;
1192- goto err ;
1188+ goto err2 ;
11931189 }
11941190
11951191 /* not in hash table yet so not strictly necessary */
@@ -1198,44 +1194,34 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
11981194 } else {
11991195 /* try an implicit helper assignation */
12001196 err = __nf_ct_try_assign_helper (ct , GFP_ATOMIC );
1201- if (err < 0 ) {
1202- rcu_read_unlock ();
1203- goto err ;
1204- }
1197+ if (err < 0 )
1198+ goto err2 ;
12051199 }
12061200
12071201 if (cda [CTA_STATUS ]) {
12081202 err = ctnetlink_change_status (ct , cda );
1209- if (err < 0 ) {
1210- rcu_read_unlock ();
1211- goto err ;
1212- }
1203+ if (err < 0 )
1204+ goto err2 ;
12131205 }
12141206
12151207 if (cda [CTA_NAT_SRC ] || cda [CTA_NAT_DST ]) {
12161208 err = ctnetlink_change_nat (ct , cda );
1217- if (err < 0 ) {
1218- rcu_read_unlock ();
1219- goto err ;
1220- }
1209+ if (err < 0 )
1210+ goto err2 ;
12211211 }
12221212
12231213#ifdef CONFIG_NF_NAT_NEEDED
12241214 if (cda [CTA_NAT_SEQ_ADJ_ORIG ] || cda [CTA_NAT_SEQ_ADJ_REPLY ]) {
12251215 err = ctnetlink_change_nat_seq_adj (ct , cda );
1226- if (err < 0 ) {
1227- rcu_read_unlock ();
1228- goto err ;
1229- }
1216+ if (err < 0 )
1217+ goto err2 ;
12301218 }
12311219#endif
12321220
12331221 if (cda [CTA_PROTOINFO ]) {
12341222 err = ctnetlink_change_protoinfo (ct , cda );
1235- if (err < 0 ) {
1236- rcu_read_unlock ();
1237- goto err ;
1238- }
1223+ if (err < 0 )
1224+ goto err2 ;
12391225 }
12401226
12411227 nf_ct_acct_ext_add (ct , GFP_ATOMIC );
@@ -1253,12 +1239,12 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
12531239
12541240 err = ctnetlink_parse_tuple (cda , & master , CTA_TUPLE_MASTER , u3 );
12551241 if (err < 0 )
1256- goto err ;
1242+ goto err2 ;
12571243
12581244 master_h = __nf_conntrack_find (& init_net , & master );
12591245 if (master_h == NULL ) {
12601246 err = - ENOENT ;
1261- goto err ;
1247+ goto err2 ;
12621248 }
12631249 master_ct = nf_ct_tuplehash_to_ctrack (master_h );
12641250 nf_conntrack_get (& master_ct -> ct_general );
@@ -1271,7 +1257,10 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
12711257 rcu_read_unlock ();
12721258
12731259 return ct ;
1274- err :
1260+
1261+ err2 :
1262+ rcu_read_unlock ();
1263+ err1 :
12751264 nf_conntrack_free (ct );
12761265 return ERR_PTR (err );
12771266}
0 commit comments