.. | .. |
---|
1308 | 1308 | struct crypto_aead *tfm; |
---|
1309 | 1309 | int ret; |
---|
1310 | 1310 | |
---|
1311 | | - /* Pick a sync gcm(aes) cipher to ensure order is preserved. */ |
---|
1312 | | - tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC); |
---|
| 1311 | + tfm = crypto_alloc_aead("gcm(aes)", 0, 0); |
---|
1313 | 1312 | |
---|
1314 | 1313 | if (IS_ERR(tfm)) |
---|
1315 | 1314 | return tfm; |
---|
.. | .. |
---|
2584 | 2583 | const struct macsec_ops *ops; |
---|
2585 | 2584 | struct macsec_context ctx; |
---|
2586 | 2585 | struct macsec_dev *macsec; |
---|
2587 | | - int ret; |
---|
| 2586 | + int ret = 0; |
---|
2588 | 2587 | |
---|
2589 | 2588 | if (!attrs[MACSEC_ATTR_IFINDEX]) |
---|
2590 | 2589 | return -EINVAL; |
---|
.. | .. |
---|
2597 | 2596 | macsec_genl_offload_policy, NULL)) |
---|
2598 | 2597 | return -EINVAL; |
---|
2599 | 2598 | |
---|
| 2599 | + rtnl_lock(); |
---|
| 2600 | + |
---|
2600 | 2601 | dev = get_dev_from_nl(genl_info_net(info), attrs); |
---|
2601 | | - if (IS_ERR(dev)) |
---|
2602 | | - return PTR_ERR(dev); |
---|
| 2602 | + if (IS_ERR(dev)) { |
---|
| 2603 | + ret = PTR_ERR(dev); |
---|
| 2604 | + goto out; |
---|
| 2605 | + } |
---|
2603 | 2606 | macsec = macsec_priv(dev); |
---|
2604 | 2607 | |
---|
2605 | | - if (!tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]) |
---|
2606 | | - return -EINVAL; |
---|
| 2608 | + if (!tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]) { |
---|
| 2609 | + ret = -EINVAL; |
---|
| 2610 | + goto out; |
---|
| 2611 | + } |
---|
2607 | 2612 | |
---|
2608 | 2613 | offload = nla_get_u8(tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]); |
---|
2609 | 2614 | if (macsec->offload == offload) |
---|
2610 | | - return 0; |
---|
| 2615 | + goto out; |
---|
2611 | 2616 | |
---|
2612 | 2617 | /* Check if the offloading mode is supported by the underlying layers */ |
---|
2613 | 2618 | if (offload != MACSEC_OFFLOAD_OFF && |
---|
2614 | | - !macsec_check_offload(offload, macsec)) |
---|
2615 | | - return -EOPNOTSUPP; |
---|
| 2619 | + !macsec_check_offload(offload, macsec)) { |
---|
| 2620 | + ret = -EOPNOTSUPP; |
---|
| 2621 | + goto out; |
---|
| 2622 | + } |
---|
2616 | 2623 | |
---|
2617 | 2624 | /* Check if the net device is busy. */ |
---|
2618 | | - if (netif_running(dev)) |
---|
2619 | | - return -EBUSY; |
---|
2620 | | - |
---|
2621 | | - rtnl_lock(); |
---|
| 2625 | + if (netif_running(dev)) { |
---|
| 2626 | + ret = -EBUSY; |
---|
| 2627 | + goto out; |
---|
| 2628 | + } |
---|
2622 | 2629 | |
---|
2623 | 2630 | prev_offload = macsec->offload; |
---|
2624 | 2631 | macsec->offload = offload; |
---|
.. | .. |
---|
2653 | 2660 | |
---|
2654 | 2661 | rollback: |
---|
2655 | 2662 | macsec->offload = prev_offload; |
---|
2656 | | - |
---|
| 2663 | +out: |
---|
2657 | 2664 | rtnl_unlock(); |
---|
2658 | 2665 | return ret; |
---|
2659 | 2666 | } |
---|