act_bpf.c (b409074e6693bcdaa7abbee2a035f22a9eabda53) | act_bpf.c (4e8ddd7f1758ca4ddd0c1f7cf3e66fce736241d2) |
---|---|
1/* 2 * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 */ --- 297 unchanged lines hidden (view full) --- 306 return ret; 307 308 res = ACT_P_CREATED; 309 } else { 310 /* Don't override defaults. */ 311 if (bind) 312 return 0; 313 | 1/* 2 * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 */ --- 297 unchanged lines hidden (view full) --- 306 return ret; 307 308 res = ACT_P_CREATED; 309 } else { 310 /* Don't override defaults. */ 311 if (bind) 312 return 0; 313 |
314 tcf_idr_release(*act, bind); 315 if (!replace) | 314 if (!replace) { 315 tcf_idr_release(*act, bind); |
316 return -EEXIST; | 316 return -EEXIST; |
317 } |
|
317 } 318 319 is_bpf = tb[TCA_ACT_BPF_OPS_LEN] && tb[TCA_ACT_BPF_OPS]; 320 is_ebpf = tb[TCA_ACT_BPF_FD]; 321 322 if ((!is_bpf && !is_ebpf) || (is_bpf && is_ebpf)) { 323 ret = -EINVAL; 324 goto out; --- 26 unchanged lines hidden (view full) --- 351 } else { 352 /* make sure the program being replaced is no longer executing */ 353 synchronize_rcu(); 354 tcf_bpf_cfg_cleanup(&old); 355 } 356 357 return res; 358out: | 318 } 319 320 is_bpf = tb[TCA_ACT_BPF_OPS_LEN] && tb[TCA_ACT_BPF_OPS]; 321 is_ebpf = tb[TCA_ACT_BPF_FD]; 322 323 if ((!is_bpf && !is_ebpf) || (is_bpf && is_ebpf)) { 324 ret = -EINVAL; 325 goto out; --- 26 unchanged lines hidden (view full) --- 352 } else { 353 /* make sure the program being replaced is no longer executing */ 354 synchronize_rcu(); 355 tcf_bpf_cfg_cleanup(&old); 356 } 357 358 return res; 359out: |
359 if (res == ACT_P_CREATED) 360 tcf_idr_release(*act, bind); | 360 tcf_idr_release(*act, bind); |
361 362 return ret; 363} 364 365static void tcf_bpf_cleanup(struct tc_action *act) 366{ 367 struct tcf_bpf_cfg tmp; 368 --- 78 unchanged lines hidden --- | 361 362 return ret; 363} 364 365static void tcf_bpf_cleanup(struct tc_action *act) 366{ 367 struct tcf_bpf_cfg tmp; 368 --- 78 unchanged lines hidden --- |