All of lore.kernel.org
 help / color / mirror / Atom feed
* Two fixes for rxe_query_port
@ 2017-06-05  8:12 Yuval Shaia
       [not found] ` <20170605081241.17920-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Yuval Shaia @ 2017-06-05  8:12 UTC (permalink / raw)
  To: monis-VPRAkNaXOzVWk0Htik3J/w, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA

Please review the attached.
Composed as patch-set since patch #2 depends on patch #1 but not enough
related to be include the two fixes in one commit

[PATCH 1/2] IB/rxe: Check return value from get_settings
[PATCH 2/2] IB/rxe: Protect call to get_link_ksettings with rtnl lock

Thanks,
Yuval
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] IB/rxe: Check return value from get_settings
       [not found] ` <20170605081241.17920-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
@ 2017-06-05  8:12   ` Yuval Shaia
  2017-06-05  8:12   ` [PATCH 2/2] IB/rxe: Protect call to get_link_ksettings with rtnl lock Yuval Shaia
  1 sibling, 0 replies; 3+ messages in thread
From: Yuval Shaia @ 2017-06-05  8:12 UTC (permalink / raw)
  To: monis-VPRAkNaXOzVWk0Htik3J/w, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA

The functions get_link_ksettings and get_settings might return bad
status indicating a failure to retrieve interface atttibutes.
Check return value to cover this case.

Signed-off-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
 drivers/infiniband/sw/rxe/rxe_verbs.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 83d709e..ffd3888 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -81,6 +81,7 @@ static int rxe_query_port(struct ib_device *dev,
 	struct rxe_dev *rxe = to_rdev(dev);
 	struct rxe_port *port;
 	u32 speed;
+	int rc = -EINVAL;
 
 	if (unlikely(port_num != 1)) {
 		pr_warn("invalid port_number %d\n", port_num);
@@ -96,14 +97,15 @@ static int rxe_query_port(struct ib_device *dev,
 	if (rxe->ndev->ethtool_ops->get_link_ksettings) {
 		struct ethtool_link_ksettings ks;
 
-		rxe->ndev->ethtool_ops->get_link_ksettings(rxe->ndev, &ks);
+		rc = rxe->ndev->ethtool_ops->get_link_ksettings(rxe->ndev, &ks);
 		speed = ks.base.speed;
 	} else if (rxe->ndev->ethtool_ops->get_settings) {
 		struct ethtool_cmd cmd;
 
-		rxe->ndev->ethtool_ops->get_settings(rxe->ndev, &cmd);
+		rc = rxe->ndev->ethtool_ops->get_settings(rxe->ndev, &cmd);
 		speed = cmd.speed;
-	} else {
+	}
+	if (rc) {
 		pr_warn("%s speed is unknown, defaulting to 1000\n",
 			rxe->ndev->name);
 		speed = 1000;
-- 
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] IB/rxe: Protect call to get_link_ksettings with rtnl lock
       [not found] ` <20170605081241.17920-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  2017-06-05  8:12   ` [PATCH 1/2] IB/rxe: Check return value from get_settings Yuval Shaia
@ 2017-06-05  8:12   ` Yuval Shaia
  1 sibling, 0 replies; 3+ messages in thread
From: Yuval Shaia @ 2017-06-05  8:12 UTC (permalink / raw)
  To: monis-VPRAkNaXOzVWk0Htik3J/w, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA

The function __ethtool_get_link_ksettings requieres rtnl lock.

Signed-off-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
 drivers/infiniband/sw/rxe/rxe_verbs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index ffd3888..af02478 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -97,7 +97,9 @@ static int rxe_query_port(struct ib_device *dev,
 	if (rxe->ndev->ethtool_ops->get_link_ksettings) {
 		struct ethtool_link_ksettings ks;
 
+		rtnl_lock();
 		rc = rxe->ndev->ethtool_ops->get_link_ksettings(rxe->ndev, &ks);
+		rtnl_unlock();
 		speed = ks.base.speed;
 	} else if (rxe->ndev->ethtool_ops->get_settings) {
 		struct ethtool_cmd cmd;
-- 
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-05  8:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-05  8:12 Two fixes for rxe_query_port Yuval Shaia
     [not found] ` <20170605081241.17920-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-06-05  8:12   ` [PATCH 1/2] IB/rxe: Check return value from get_settings Yuval Shaia
2017-06-05  8:12   ` [PATCH 2/2] IB/rxe: Protect call to get_link_ksettings with rtnl lock Yuval Shaia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.