* [PATCH] IB/rxe: Check return value from get_settings @ 2017-06-04 17:06 Yuval Shaia [not found] ` <20170604170619.3697-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Yuval Shaia @ 2017-06-04 17:06 UTC (permalink / raw) To: monis-VPRAkNaXOzVWk0Htik3J/w, dledford-H+wXaHxf7aLQT0dZR+AlfA, sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA Cc: Yuval Shaia 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
[parent not found: <20170604170619.3697-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] IB/rxe: Check return value from get_settings [not found] ` <20170604170619.3697-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> @ 2017-06-04 17:26 ` Leon Romanovsky [not found] ` <20170604172630.GF6868-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Leon Romanovsky @ 2017-06-04 17:26 UTC (permalink / raw) To: Yuval Shaia Cc: monis-VPRAkNaXOzVWk0Htik3J/w, dledford-H+wXaHxf7aLQT0dZR+AlfA, sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 520 bytes --] On Sun, Jun 04, 2017 at 08:06:19PM +0300, Yuval Shaia wrote: > 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(-) > Thanks, Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20170604172630.GF6868-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>]
* Re: [PATCH] IB/rxe: Check return value from get_settings [not found] ` <20170604172630.GF6868-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> @ 2017-06-05 7:59 ` Yuval Shaia 0 siblings, 0 replies; 3+ messages in thread From: Yuval Shaia @ 2017-06-05 7:59 UTC (permalink / raw) To: Leon Romanovsky Cc: monis-VPRAkNaXOzVWk0Htik3J/w, dledford-H+wXaHxf7aLQT0dZR+AlfA, sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA On Sun, Jun 04, 2017 at 08:26:30PM +0300, Leon Romanovsky wrote: > On Sun, Jun 04, 2017 at 08:06:19PM +0300, Yuval Shaia wrote: > > 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(-) > > > > Thanks, > Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> Thanks Leon for your review. I'm about to post another version for this patch and will appreciate your review. Looks like call to get_link_ksettings should be protected by rtnl lock, it is undocumented but for example __ethtool_get_link_ksettings prints an ugly dump_stack when this happen. I will do the same as what is done in function __to_ib_speed_width -- 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
end of thread, other threads:[~2017-06-05 7:59 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-06-04 17:06 [PATCH] IB/rxe: Check return value from get_settings Yuval Shaia [not found] ` <20170604170619.3697-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2017-06-04 17:26 ` Leon Romanovsky [not found] ` <20170604172630.GF6868-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> 2017-06-05 7:59 ` 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.