From: Greg Kroah-Hartman Date: Thu, 4 Feb 2021 15:03:58 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v4.4.256~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d99d41dc11c08299f0c82130a4a4d413176b6ba;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: ibmvnic-ensure-that-crq-entry-read-are-correctly-ordered.patch net-dsa-bcm_sf2-put-device-node-before-return.patch net-switchdev-don-t-set-port_obj_info-handled-true-when-eopnotsupp.patch revert-revert-block-end-bio-with-blk_sts_again-in-case-of-non-mq-devs-and-req_nowait.patch --- diff --git a/queue-5.4/ibmvnic-ensure-that-crq-entry-read-are-correctly-ordered.patch b/queue-5.4/ibmvnic-ensure-that-crq-entry-read-are-correctly-ordered.patch new file mode 100644 index 00000000000..65986957b5a --- /dev/null +++ b/queue-5.4/ibmvnic-ensure-that-crq-entry-read-are-correctly-ordered.patch @@ -0,0 +1,38 @@ +From e41aec79e62fa50f940cf222d1e9577f14e149dc Mon Sep 17 00:00:00 2001 +From: Lijun Pan +Date: Wed, 27 Jan 2021 19:34:42 -0600 +Subject: ibmvnic: Ensure that CRQ entry read are correctly ordered + +From: Lijun Pan + +commit e41aec79e62fa50f940cf222d1e9577f14e149dc upstream. + +Ensure that received Command-Response Queue (CRQ) entries are +properly read in order by the driver. dma_rmb barrier has +been added before accessing the CRQ descriptor to ensure +the entire descriptor is read before processing. + +Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol") +Signed-off-by: Lijun Pan +Link: https://lore.kernel.org/r/20210128013442.88319-1-ljp@linux.ibm.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/ibm/ibmvnic.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -4752,6 +4752,12 @@ static void ibmvnic_tasklet(void *data) + while (!done) { + /* Pull all the valid messages off the CRQ */ + while ((crq = ibmvnic_next_crq(adapter)) != NULL) { ++ /* This barrier makes sure ibmvnic_next_crq()'s ++ * crq->generic.first & IBMVNIC_CRQ_CMD_RSP is loaded ++ * before ibmvnic_handle_crq()'s ++ * switch(gen_crq->first) and switch(gen_crq->cmd). ++ */ ++ dma_rmb(); + ibmvnic_handle_crq(crq, adapter); + crq->generic.first = 0; + } diff --git a/queue-5.4/net-dsa-bcm_sf2-put-device-node-before-return.patch b/queue-5.4/net-dsa-bcm_sf2-put-device-node-before-return.patch new file mode 100644 index 00000000000..ff8b82fc3cb --- /dev/null +++ b/queue-5.4/net-dsa-bcm_sf2-put-device-node-before-return.patch @@ -0,0 +1,44 @@ +From cf3c46631e1637582f517a574c77cd6c05793817 Mon Sep 17 00:00:00 2001 +From: Pan Bian +Date: Thu, 21 Jan 2021 04:33:43 -0800 +Subject: net: dsa: bcm_sf2: put device node before return + +From: Pan Bian + +commit cf3c46631e1637582f517a574c77cd6c05793817 upstream. + +Put the device node dn before return error code on failure path. + +Fixes: 461cd1b03e32 ("net: dsa: bcm_sf2: Register our slave MDIO bus") +Signed-off-by: Pan Bian +Link: https://lore.kernel.org/r/20210121123343.26330-1-bianpan2016@163.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/dsa/bcm_sf2.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -421,15 +421,19 @@ static int bcm_sf2_mdio_register(struct + /* Find our integrated MDIO bus node */ + dn = of_find_compatible_node(NULL, NULL, "brcm,unimac-mdio"); + priv->master_mii_bus = of_mdio_find_bus(dn); +- if (!priv->master_mii_bus) ++ if (!priv->master_mii_bus) { ++ of_node_put(dn); + return -EPROBE_DEFER; ++ } + + get_device(&priv->master_mii_bus->dev); + priv->master_mii_dn = dn; + + priv->slave_mii_bus = devm_mdiobus_alloc(ds->dev); +- if (!priv->slave_mii_bus) ++ if (!priv->slave_mii_bus) { ++ of_node_put(dn); + return -ENOMEM; ++ } + + priv->slave_mii_bus->priv = priv; + priv->slave_mii_bus->name = "sf2 slave mii"; diff --git a/queue-5.4/net-switchdev-don-t-set-port_obj_info-handled-true-when-eopnotsupp.patch b/queue-5.4/net-switchdev-don-t-set-port_obj_info-handled-true-when-eopnotsupp.patch new file mode 100644 index 00000000000..afcf080067e --- /dev/null +++ b/queue-5.4/net-switchdev-don-t-set-port_obj_info-handled-true-when-eopnotsupp.patch @@ -0,0 +1,97 @@ +From 20776b465c0c249f5e5b5b4fe077cd24ef1cda86 Mon Sep 17 00:00:00 2001 +From: Rasmus Villemoes +Date: Mon, 25 Jan 2021 13:41:16 +0100 +Subject: net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP + +From: Rasmus Villemoes + +commit 20776b465c0c249f5e5b5b4fe077cd24ef1cda86 upstream. + +It's not true that switchdev_port_obj_notify() only inspects the +->handled field of "struct switchdev_notifier_port_obj_info" if +call_switchdev_blocking_notifiers() returns 0 - there's a WARN_ON() +triggering for a non-zero return combined with ->handled not being +true. But the real problem here is that -EOPNOTSUPP is not being +properly handled. + +The wrapper functions switchdev_handle_port_obj_add() et al change a +return value of -EOPNOTSUPP to 0, and the treatment of ->handled in +switchdev_port_obj_notify() seems to be designed to change that back +to -EOPNOTSUPP in case nobody actually acted on the notifier (i.e., +everybody returned -EOPNOTSUPP). + +Currently, as soon as some device down the stack passes the check_cb() +check, ->handled gets set to true, which means that +switchdev_port_obj_notify() cannot actually ever return -EOPNOTSUPP. + +This, for example, means that the detection of hardware offload +support in the MRP code is broken: switchdev_port_obj_add() used by +br_mrp_switchdev_send_ring_test() always returns 0, so since the MRP +code thinks the generation of MRP test frames has been offloaded, no +such frames are actually put on the wire. Similarly, +br_mrp_switchdev_set_ring_role() also always returns 0, causing +mrp->ring_role_offloaded to be set to 1. + +To fix this, continue to set ->handled true if any callback returns +success or any error distinct from -EOPNOTSUPP. But if all the +callbacks return -EOPNOTSUPP, make sure that ->handled stays false, so +the logic in switchdev_port_obj_notify() can propagate that +information. + +Fixes: 9a9f26e8f7ea ("bridge: mrp: Connect MRP API with the switchdev API") +Fixes: f30f0601eb93 ("switchdev: Add helpers to aid traversal through lower devices") +Reviewed-by: Petr Machata +Signed-off-by: Rasmus Villemoes +Link: https://lore.kernel.org/r/20210125124116.102928-1-rasmus.villemoes@prevas.dk +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/switchdev/switchdev.c | 23 +++++++++++++---------- + 1 file changed, 13 insertions(+), 10 deletions(-) + +--- a/net/switchdev/switchdev.c ++++ b/net/switchdev/switchdev.c +@@ -461,10 +461,11 @@ static int __switchdev_handle_port_obj_a + extack = switchdev_notifier_info_to_extack(&port_obj_info->info); + + if (check_cb(dev)) { +- /* This flag is only checked if the return value is success. */ +- port_obj_info->handled = true; +- return add_cb(dev, port_obj_info->obj, port_obj_info->trans, +- extack); ++ err = add_cb(dev, port_obj_info->obj, port_obj_info->trans, ++ extack); ++ if (err != -EOPNOTSUPP) ++ port_obj_info->handled = true; ++ return err; + } + + /* Switch ports might be stacked under e.g. a LAG. Ignore the +@@ -513,9 +514,10 @@ static int __switchdev_handle_port_obj_d + int err = -EOPNOTSUPP; + + if (check_cb(dev)) { +- /* This flag is only checked if the return value is success. */ +- port_obj_info->handled = true; +- return del_cb(dev, port_obj_info->obj); ++ err = del_cb(dev, port_obj_info->obj); ++ if (err != -EOPNOTSUPP) ++ port_obj_info->handled = true; ++ return err; + } + + /* Switch ports might be stacked under e.g. a LAG. Ignore the +@@ -563,9 +565,10 @@ static int __switchdev_handle_port_attr_ + int err = -EOPNOTSUPP; + + if (check_cb(dev)) { +- port_attr_info->handled = true; +- return set_cb(dev, port_attr_info->attr, +- port_attr_info->trans); ++ err = set_cb(dev, port_attr_info->attr, port_attr_info->trans); ++ if (err != -EOPNOTSUPP) ++ port_attr_info->handled = true; ++ return err; + } + + /* Switch ports might be stacked under e.g. a LAG. Ignore the diff --git a/queue-5.4/revert-revert-block-end-bio-with-blk_sts_again-in-case-of-non-mq-devs-and-req_nowait.patch b/queue-5.4/revert-revert-block-end-bio-with-blk_sts_again-in-case-of-non-mq-devs-and-req_nowait.patch new file mode 100644 index 00000000000..a6401ec1891 --- /dev/null +++ b/queue-5.4/revert-revert-block-end-bio-with-blk_sts_again-in-case-of-non-mq-devs-and-req_nowait.patch @@ -0,0 +1,42 @@ +From b89e8b74e83de2a47ba2a23a26130a42e37a7f18 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Thu, 4 Feb 2021 16:02:10 +0100 +Subject: Revert "Revert "block: end bio with BLK_STS_AGAIN in case of non-mq devs and REQ_NOWAIT"" + +From: Greg Kroah-Hartman + +This reverts commit bba91cdba612fbce4f8575c5d94d2b146fb83ea3 which is +commit b0beb28097fa04177b3769f4bb7a0d0d9c4ae76e upstream. + +It breaks things in 5.4.y, so let's drop it. + +Reported-by: Andres Freund +Cc: Bijan Mottahedeh +CC: Jens Axboe +Cc: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + block/blk-core.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- a/block/blk-core.c ++++ b/block/blk-core.c +@@ -886,11 +886,14 @@ generic_make_request_checks(struct bio * + } + + /* +- * For a REQ_NOWAIT based request, return -EOPNOTSUPP +- * if queue is not a request based queue. ++ * Non-mq queues do not honor REQ_NOWAIT, so complete a bio ++ * with BLK_STS_AGAIN status in order to catch -EAGAIN and ++ * to give a chance to the caller to repeat request gracefully. + */ +- if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q)) +- goto not_supported; ++ if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q)) { ++ status = BLK_STS_AGAIN; ++ goto end_io; ++ } + + if (should_fail_bio(bio)) + goto end_io; diff --git a/queue-5.4/series b/queue-5.4/series new file mode 100644 index 00000000000..5aa3ceb83ed --- /dev/null +++ b/queue-5.4/series @@ -0,0 +1,4 @@ +net-dsa-bcm_sf2-put-device-node-before-return.patch +net-switchdev-don-t-set-port_obj_info-handled-true-when-eopnotsupp.patch +ibmvnic-ensure-that-crq-entry-read-are-correctly-ordered.patch +revert-revert-block-end-bio-with-blk_sts_again-in-case-of-non-mq-devs-and-req_nowait.patch