lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <f2f31af4-d8a6-a961-aa2a-f7b29203a3f4@users.sourceforge.net>
Date:   Wed, 8 Nov 2017 17:15:59 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-wpan@...r.kernel.org, netdev@...r.kernel.org,
        Alexander Aring <alex.aring@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Stefan Schmidt <stefan@....samsung.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH] nl802154: Improve unlocking of a table in four functions

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 8 Nov 2017 17:08:55 +0100

* Add jump targets so that a call of the function "rdev_unlock_llsec_table"
  is stored only once in these function implementations.

* Replace four calls by goto statements.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 net/ieee802154/nl802154.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 99f6c254ea77..33865d355433 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1527,16 +1527,16 @@ nl802154_dump_llsec_key(struct sk_buff *skb, struct netlink_callback *cb)
 				      rdev, wpan_dev->netdev, key) < 0) {
 			/* TODO */
 			err = -EIO;
-			rdev_unlock_llsec_table(rdev, wpan_dev);
-			goto out_err;
+			goto unlock_table;
 		}
 	}
 
 	cb->args[2] = 1;
 
 out:
-	rdev_unlock_llsec_table(rdev, wpan_dev);
 	err = skb->len;
+unlock_table:
+	rdev_unlock_llsec_table(rdev, wpan_dev);
 out_err:
 	nl802154_finish_wpan_dev_dump(rdev);
 
@@ -1697,16 +1697,16 @@ nl802154_dump_llsec_dev(struct sk_buff *skb, struct netlink_callback *cb)
 					 rdev, wpan_dev->netdev, dev) < 0) {
 			/* TODO */
 			err = -EIO;
-			rdev_unlock_llsec_table(rdev, wpan_dev);
-			goto out_err;
+			goto unlock_table;
 		}
 	}
 
 	cb->args[2] = 1;
 
 out:
-	rdev_unlock_llsec_table(rdev, wpan_dev);
 	err = skb->len;
+unlock_table:
+	rdev_unlock_llsec_table(rdev, wpan_dev);
 out_err:
 	nl802154_finish_wpan_dev_dump(rdev);
 
@@ -1875,8 +1875,7 @@ nl802154_dump_llsec_devkey(struct sk_buff *skb, struct netlink_callback *cb)
 						 kpos) < 0) {
 				/* TODO */
 				err = -EIO;
-				rdev_unlock_llsec_table(rdev, wpan_dev);
-				goto out_err;
+				goto unlock_table;
 			}
 		}
 	}
@@ -1884,8 +1883,9 @@ nl802154_dump_llsec_devkey(struct sk_buff *skb, struct netlink_callback *cb)
 	cb->args[2] = 1;
 
 out:
-	rdev_unlock_llsec_table(rdev, wpan_dev);
 	err = skb->len;
+unlock_table:
+	rdev_unlock_llsec_table(rdev, wpan_dev);
 out_err:
 	nl802154_finish_wpan_dev_dump(rdev);
 
@@ -2034,16 +2034,16 @@ nl802154_dump_llsec_seclevel(struct sk_buff *skb, struct netlink_callback *cb)
 					   rdev, wpan_dev->netdev, sl) < 0) {
 			/* TODO */
 			err = -EIO;
-			rdev_unlock_llsec_table(rdev, wpan_dev);
-			goto out_err;
+			goto unlock_table;
 		}
 	}
 
 	cb->args[2] = 1;
 
 out:
-	rdev_unlock_llsec_table(rdev, wpan_dev);
 	err = skb->len;
+unlock_table:
+	rdev_unlock_llsec_table(rdev, wpan_dev);
 out_err:
 	nl802154_finish_wpan_dev_dump(rdev);
 
-- 
2.15.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ