From: Greg Kroah-Hartman Date: Fri, 1 Apr 2022 15:36:50 +0000 (+0200) Subject: 5.16-stable patches X-Git-Tag: v4.14.275~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eabb6108642de28b6c3092fb8c90c045b77123e8;p=thirdparty%2Fkernel%2Fstable-queue.git 5.16-stable patches added patches: qed-display-vf-trust-config.patch qed-validate-and-restrict-untrusted-vfs-vlan-promisc-mode.patch scsi-libsas-fix-sas_ata_qc_issue-handling-of-ncq-non-data-commands.patch scsi-scsi_transport_fc-fix-fpin-link-integrity-statistics-counters.patch --- diff --git a/queue-5.16/qed-display-vf-trust-config.patch b/queue-5.16/qed-display-vf-trust-config.patch new file mode 100644 index 00000000000..5f0fb4b3bf7 --- /dev/null +++ b/queue-5.16/qed-display-vf-trust-config.patch @@ -0,0 +1,32 @@ +From 4e6e6bec7440b9b76f312f28b1f4e944eebb3abc Mon Sep 17 00:00:00 2001 +From: Manish Chopra +Date: Wed, 2 Mar 2022 02:52:21 -0800 +Subject: qed: display VF trust config + +From: Manish Chopra + +commit 4e6e6bec7440b9b76f312f28b1f4e944eebb3abc upstream. + +Driver does support SR-IOV VFs trust configuration but +it does not display it when queried via ip link utility. + +Cc: stable@vger.kernel.org +Fixes: f990c82c385b ("qed*: Add support for ndo_set_vf_trust") +Signed-off-by: Manish Chopra +Signed-off-by: Ariel Elior +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/qlogic/qed/qed_sriov.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c +@@ -4719,6 +4719,7 @@ static int qed_get_vf_config(struct qed_ + tx_rate = vf_info->tx_rate; + ivi->max_tx_rate = tx_rate ? tx_rate : link.speed; + ivi->min_tx_rate = qed_iov_get_vf_min_rate(hwfn, vf_id); ++ ivi->trusted = vf_info->is_trusted_request; + + return 0; + } diff --git a/queue-5.16/qed-validate-and-restrict-untrusted-vfs-vlan-promisc-mode.patch b/queue-5.16/qed-validate-and-restrict-untrusted-vfs-vlan-promisc-mode.patch new file mode 100644 index 00000000000..2d7e7fdedce --- /dev/null +++ b/queue-5.16/qed-validate-and-restrict-untrusted-vfs-vlan-promisc-mode.patch @@ -0,0 +1,108 @@ +From cbcc44db2cf7b836896733acc0e5ea966136ed22 Mon Sep 17 00:00:00 2001 +From: Manish Chopra +Date: Wed, 2 Mar 2022 02:52:22 -0800 +Subject: qed: validate and restrict untrusted VFs vlan promisc mode + +From: Manish Chopra + +commit cbcc44db2cf7b836896733acc0e5ea966136ed22 upstream. + +Today when VFs are put in promiscuous mode, they can request PF +to configure device for them to receive all VLANs traffic regardless +of what vlan is configured by the PF (via ip link) and PF allows this +config request regardless of whether VF is trusted or not. + +From security POV, when VLAN is configured for VF through PF (via ip link), +honour such config requests from VF only when they are configured to be +trusted, otherwise restrict such VFs vlan promisc mode config. + +Cc: stable@vger.kernel.org +Fixes: f990c82c385b ("qed*: Add support for ndo_set_vf_trust") +Signed-off-by: Manish Chopra +Signed-off-by: Ariel Elior +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/qlogic/qed/qed_sriov.c | 28 ++++++++++++++++++++++++++-- + drivers/net/ethernet/qlogic/qed/qed_sriov.h | 1 + + 2 files changed, 27 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c +@@ -2984,12 +2984,16 @@ static int qed_iov_pre_update_vport(stru + u8 mask = QED_ACCEPT_UCAST_UNMATCHED | QED_ACCEPT_MCAST_UNMATCHED; + struct qed_filter_accept_flags *flags = ¶ms->accept_flags; + struct qed_public_vf_info *vf_info; ++ u16 tlv_mask; ++ ++ tlv_mask = BIT(QED_IOV_VP_UPDATE_ACCEPT_PARAM) | ++ BIT(QED_IOV_VP_UPDATE_ACCEPT_ANY_VLAN); + + /* Untrusted VFs can't even be trusted to know that fact. + * Simply indicate everything is configured fine, and trace + * configuration 'behind their back'. + */ +- if (!(*tlvs & BIT(QED_IOV_VP_UPDATE_ACCEPT_PARAM))) ++ if (!(*tlvs & tlv_mask)) + return 0; + + vf_info = qed_iov_get_public_vf_info(hwfn, vfid, true); +@@ -3006,6 +3010,13 @@ static int qed_iov_pre_update_vport(stru + flags->tx_accept_filter &= ~mask; + } + ++ if (params->update_accept_any_vlan_flg) { ++ vf_info->accept_any_vlan = params->accept_any_vlan; ++ ++ if (vf_info->forced_vlan && !vf_info->is_trusted_configured) ++ params->accept_any_vlan = false; ++ } ++ + return 0; + } + +@@ -5150,6 +5161,12 @@ static void qed_iov_handle_trust_change( + + params.update_ctl_frame_check = 1; + params.mac_chk_en = !vf_info->is_trusted_configured; ++ params.update_accept_any_vlan_flg = 0; ++ ++ if (vf_info->accept_any_vlan && vf_info->forced_vlan) { ++ params.update_accept_any_vlan_flg = 1; ++ params.accept_any_vlan = vf_info->accept_any_vlan; ++ } + + if (vf_info->rx_accept_mode & mask) { + flags->update_rx_mode_config = 1; +@@ -5165,13 +5182,20 @@ static void qed_iov_handle_trust_change( + if (!vf_info->is_trusted_configured) { + flags->rx_accept_filter &= ~mask; + flags->tx_accept_filter &= ~mask; ++ params.accept_any_vlan = false; + } + + if (flags->update_rx_mode_config || + flags->update_tx_mode_config || +- params.update_ctl_frame_check) ++ params.update_ctl_frame_check || ++ params.update_accept_any_vlan_flg) { ++ DP_VERBOSE(hwfn, QED_MSG_IOV, ++ "vport update config for %s VF[abs 0x%x rel 0x%x]\n", ++ vf_info->is_trusted_configured ? "trusted" : "untrusted", ++ vf->abs_vf_id, vf->relative_vf_id); + qed_sp_vport_update(hwfn, ¶ms, + QED_SPQ_MODE_EBLOCK, NULL); ++ } + } + } + +--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.h ++++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.h +@@ -62,6 +62,7 @@ struct qed_public_vf_info { + bool is_trusted_request; + u8 rx_accept_mode; + u8 tx_accept_mode; ++ bool accept_any_vlan; + }; + + struct qed_iov_vf_init_params { diff --git a/queue-5.16/scsi-libsas-fix-sas_ata_qc_issue-handling-of-ncq-non-data-commands.patch b/queue-5.16/scsi-libsas-fix-sas_ata_qc_issue-handling-of-ncq-non-data-commands.patch new file mode 100644 index 00000000000..4303164cdf0 --- /dev/null +++ b/queue-5.16/scsi-libsas-fix-sas_ata_qc_issue-handling-of-ncq-non-data-commands.patch @@ -0,0 +1,41 @@ +From 8454563e4c2aafbfb81a383ab423ea8b9b430a25 Mon Sep 17 00:00:00 2001 +From: Damien Le Moal +Date: Sun, 20 Feb 2022 12:17:40 +0900 +Subject: scsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands + +From: Damien Le Moal + +commit 8454563e4c2aafbfb81a383ab423ea8b9b430a25 upstream. + +To detect for the DMA_NONE (no data transfer) DMA direction, +sas_ata_qc_issue() tests if the command protocol is ATA_PROT_NODATA. This +test does not include the ATA_CMD_NCQ_NON_DATA command as this command +protocol is defined as ATA_PROT_NCQ_NODATA (equal to ATA_PROT_FLAG_NCQ) and +not as ATA_PROT_NODATA. + +To include both NCQ and non-NCQ commands when testing for the DMA_NONE DMA +direction, use "!ata_is_data()". + +Link: https://lore.kernel.org/r/20220220031810.738362-2-damien.lemoal@opensource.wdc.com +Fixes: 176ddd89171d ("scsi: libsas: Reset num_scatter if libata marks qc as NODATA") +Cc: stable@vger.kernel.org +Reviewed-by: John Garry +Reviewed-by: Jack Wang +Signed-off-by: Damien Le Moal +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/libsas/sas_ata.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/libsas/sas_ata.c ++++ b/drivers/scsi/libsas/sas_ata.c +@@ -197,7 +197,7 @@ static unsigned int sas_ata_qc_issue(str + task->total_xfer_len = qc->nbytes; + task->num_scatter = qc->n_elem; + task->data_dir = qc->dma_dir; +- } else if (qc->tf.protocol == ATA_PROT_NODATA) { ++ } else if (!ata_is_data(qc->tf.protocol)) { + task->data_dir = DMA_NONE; + } else { + for_each_sg(qc->sg, sg, qc->n_elem, si) diff --git a/queue-5.16/scsi-scsi_transport_fc-fix-fpin-link-integrity-statistics-counters.patch b/queue-5.16/scsi-scsi_transport_fc-fix-fpin-link-integrity-statistics-counters.patch new file mode 100644 index 00000000000..7abce24b098 --- /dev/null +++ b/queue-5.16/scsi-scsi_transport_fc-fix-fpin-link-integrity-statistics-counters.patch @@ -0,0 +1,128 @@ +From 07e0984b96ec1ba8c6de1c092b986b00ea0c114c Mon Sep 17 00:00:00 2001 +From: James Smart +Date: Tue, 1 Mar 2022 09:55:36 -0800 +Subject: scsi: scsi_transport_fc: Fix FPIN Link Integrity statistics counters + +From: James Smart + +commit 07e0984b96ec1ba8c6de1c092b986b00ea0c114c upstream. + +In the original FPIN commit, stats were incremented by the event_count. +Event_count is the minimum # of events that must occur before an FPIN is +sent. Thus, its not the actual number of events, and could be significantly +off (too low) as it doesn't reflect anything not reported. Rather than +attempt to count events, have the statistic count how many FPINS cross the +threshold and were reported. + +Link: https://lore.kernel.org/r/20220301175536.60250-1-jsmart2021@gmail.com +Fixes: 3dcfe0de5a97 ("scsi: fc: Parse FPIN packets and update statistics") +Cc: # v5.11+ +Cc: Shyam Sundar +Cc: Nilesh Javali +Reviewed-by: Himanshu Madhani +Signed-off-by: James Smart +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/scsi_transport_fc.c | 39 ++++++++++++++++----------------------- + 1 file changed, 16 insertions(+), 23 deletions(-) + +--- a/drivers/scsi/scsi_transport_fc.c ++++ b/drivers/scsi/scsi_transport_fc.c +@@ -34,7 +34,7 @@ static int fc_bsg_hostadd(struct Scsi_Ho + static int fc_bsg_rportadd(struct Scsi_Host *, struct fc_rport *); + static void fc_bsg_remove(struct request_queue *); + static void fc_bsg_goose_queue(struct fc_rport *); +-static void fc_li_stats_update(struct fc_fn_li_desc *li_desc, ++static void fc_li_stats_update(u16 event_type, + struct fc_fpin_stats *stats); + static void fc_delivery_stats_update(u32 reason_code, + struct fc_fpin_stats *stats); +@@ -670,42 +670,34 @@ fc_find_rport_by_wwpn(struct Scsi_Host * + EXPORT_SYMBOL(fc_find_rport_by_wwpn); + + static void +-fc_li_stats_update(struct fc_fn_li_desc *li_desc, ++fc_li_stats_update(u16 event_type, + struct fc_fpin_stats *stats) + { +- stats->li += be32_to_cpu(li_desc->event_count); +- switch (be16_to_cpu(li_desc->event_type)) { ++ stats->li++; ++ switch (event_type) { + case FPIN_LI_UNKNOWN: +- stats->li_failure_unknown += +- be32_to_cpu(li_desc->event_count); ++ stats->li_failure_unknown++; + break; + case FPIN_LI_LINK_FAILURE: +- stats->li_link_failure_count += +- be32_to_cpu(li_desc->event_count); ++ stats->li_link_failure_count++; + break; + case FPIN_LI_LOSS_OF_SYNC: +- stats->li_loss_of_sync_count += +- be32_to_cpu(li_desc->event_count); ++ stats->li_loss_of_sync_count++; + break; + case FPIN_LI_LOSS_OF_SIG: +- stats->li_loss_of_signals_count += +- be32_to_cpu(li_desc->event_count); ++ stats->li_loss_of_signals_count++; + break; + case FPIN_LI_PRIM_SEQ_ERR: +- stats->li_prim_seq_err_count += +- be32_to_cpu(li_desc->event_count); ++ stats->li_prim_seq_err_count++; + break; + case FPIN_LI_INVALID_TX_WD: +- stats->li_invalid_tx_word_count += +- be32_to_cpu(li_desc->event_count); ++ stats->li_invalid_tx_word_count++; + break; + case FPIN_LI_INVALID_CRC: +- stats->li_invalid_crc_count += +- be32_to_cpu(li_desc->event_count); ++ stats->li_invalid_crc_count++; + break; + case FPIN_LI_DEVICE_SPEC: +- stats->li_device_specific += +- be32_to_cpu(li_desc->event_count); ++ stats->li_device_specific++; + break; + } + } +@@ -767,6 +759,7 @@ fc_fpin_li_stats_update(struct Scsi_Host + struct fc_rport *attach_rport = NULL; + struct fc_host_attrs *fc_host = shost_to_fc_host(shost); + struct fc_fn_li_desc *li_desc = (struct fc_fn_li_desc *)tlv; ++ u16 event_type = be16_to_cpu(li_desc->event_type); + u64 wwpn; + + rport = fc_find_rport_by_wwpn(shost, +@@ -775,7 +768,7 @@ fc_fpin_li_stats_update(struct Scsi_Host + (rport->roles & FC_PORT_ROLE_FCP_TARGET || + rport->roles & FC_PORT_ROLE_NVME_TARGET)) { + attach_rport = rport; +- fc_li_stats_update(li_desc, &attach_rport->fpin_stats); ++ fc_li_stats_update(event_type, &attach_rport->fpin_stats); + } + + if (be32_to_cpu(li_desc->pname_count) > 0) { +@@ -789,14 +782,14 @@ fc_fpin_li_stats_update(struct Scsi_Host + rport->roles & FC_PORT_ROLE_NVME_TARGET)) { + if (rport == attach_rport) + continue; +- fc_li_stats_update(li_desc, ++ fc_li_stats_update(event_type, + &rport->fpin_stats); + } + } + } + + if (fc_host->port_name == be64_to_cpu(li_desc->attached_wwpn)) +- fc_li_stats_update(li_desc, &fc_host->fpin_stats); ++ fc_li_stats_update(event_type, &fc_host->fpin_stats); + } + + /* diff --git a/queue-5.16/series b/queue-5.16/series index 1d96657b66f..f03d8253818 100644 --- a/queue-5.16/series +++ b/queue-5.16/series @@ -90,3 +90,7 @@ mm-invalidate-hwpoison-page-cache-page-in-fault-path.patch mempolicy-mbind_range-set_policy-after-vma_merge.patch scsi-core-sd-add-silence_suspend-flag-to-suppress-some-pm-messages.patch scsi-ufs-fix-runtime-pm-messages-never-ending-cycle.patch +scsi-scsi_transport_fc-fix-fpin-link-integrity-statistics-counters.patch +scsi-libsas-fix-sas_ata_qc_issue-handling-of-ncq-non-data-commands.patch +qed-display-vf-trust-config.patch +qed-validate-and-restrict-untrusted-vfs-vlan-promisc-mode.patch