hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/net/macsec.c
....@@ -1308,8 +1308,7 @@
13081308 struct crypto_aead *tfm;
13091309 int ret;
13101310
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);
13131312
13141313 if (IS_ERR(tfm))
13151314 return tfm;
....@@ -2584,7 +2583,7 @@
25842583 const struct macsec_ops *ops;
25852584 struct macsec_context ctx;
25862585 struct macsec_dev *macsec;
2587
- int ret;
2586
+ int ret = 0;
25882587
25892588 if (!attrs[MACSEC_ATTR_IFINDEX])
25902589 return -EINVAL;
....@@ -2597,28 +2596,36 @@
25972596 macsec_genl_offload_policy, NULL))
25982597 return -EINVAL;
25992598
2599
+ rtnl_lock();
2600
+
26002601 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
+ }
26032606 macsec = macsec_priv(dev);
26042607
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
+ }
26072612
26082613 offload = nla_get_u8(tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]);
26092614 if (macsec->offload == offload)
2610
- return 0;
2615
+ goto out;
26112616
26122617 /* Check if the offloading mode is supported by the underlying layers */
26132618 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
+ }
26162623
26172624 /* 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
+ }
26222629
26232630 prev_offload = macsec->offload;
26242631 macsec->offload = offload;
....@@ -2653,7 +2660,7 @@
26532660
26542661 rollback:
26552662 macsec->offload = prev_offload;
2656
-
2663
+out:
26572664 rtnl_unlock();
26582665 return ret;
26592666 }