linux-4.2-rc7/drivers/scsi/bfa/bfad_bsg.c:108: bad sanity check on array index ?
Hello there, [linux-4.2-rc7/drivers/scsi/bfa/bfad_bsg.c:108]: (style) Array index 'i' is used before limits check. Source code is for (i = 0; iocmd->adapter_hwpath[i] != ':' && i < BFA_STRING_32; i++) Suggest sanity check array index before use. Regards David Binderman -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Telegrafische Überweisung HINWEIS
Standard Chartered Bank Dubai Main Branch, Al Fardan Gebäude, Al Mankhool Road, P.O. Box 999, Dubai, Vereinigte Arabische Emirate Sehr geehrte Kunden, Telegrafische Überweisung HINWEIS. Wir sind hiermit offiziell informieren Sie über Ihre Fondstelegrafische Überweisung durch unsere Bank, Standard Chartered Bank, auf Ihr Bankkonto, die offiziell von der Leitung der Weltbank Swiss (WBS) genehmigt worden ist, um die Summe von $ 5.500,000.00 USD in Credit Ihrer Bank Konto. Beachten Sie, dass ich die Bearbeitung Ihrer Zahlung und alles über die sofortige Überweisung von Ihrem Fonds wird innerhalb kürzester Zeit von der Zeit, die wir Ihren Unten benötigten Informationen erhalten geführt werden gestartet. Auch darüber informiert, dass der Gouverneur von Standard Chartered Bank (UAE) Plc auf Ihrer Avis unterschreiben und eine Kopie der Beratung wird bei der Weltbank in der Schweiz für einige Aufzeichnungszwecke versandt werden. Inzwischen Ihrer Information und Ihre vollständigen Kontaktdaten wurden aus unserer Forschung manager.Barrister Paul Dean eingehen, werden in Ihrem Namen, um eine zu erhalten, zu handeln AFIDAVIT ANSPRUCHS zur sofortigen Veröffentlichung Ihres Fonds. Dieser Fonds war Teil der eingereichten verstorbenen Präsidenten Saddam Hussein im Irak Discovery Fund der Weltbank der Schweiz, die die Schweizer Bank hat beschlossen, es zu großzügig verteilen helfen wenigen glücklichen Menschen, und die Europäische Union wird im Einvernehmen mit der Schweizerischen Bank, den Fonds auf 700 hunderttausend Menschen in Amerika, Europa und Asien, Naher Osten Afrika in andere zu verteilen, um zur Verbesserung ihrer Unternehmen. Daher bestätigen die die unten angegebenen Informationen genau, denn dieses Amt nicht leisten können, haftet für falsche Übertragung von Mitteln oder Haftung eines Fonds in ein unbekanntes Konto gutgeschrieben gehalten werden. Das einzige, was von Ihnen verlangt wird, um die eidesstattliche Erklärung ANSPRUCH zu erhalten, damit wir Ihrem Konto direkt durch telegrafische Überweisung oder über eine unserer entsprechenden Banken und schickt Kopien der Geldtransfer Freigabedokumente für Sie und Ihre Banker zur Bestätigung. Sollten Sie unsere Richtlinien befolgen, werden Ihre Fonds gutgeschrieben und beziehen sich auf Ihrem Bankkonto innerhalb von fünf (5) Bankarbeitstagen ab dem Tag, Sie diese eidesstattliche Erklärung ANSPRUCH erhalten. Für weitere Informationen und Unterstützung auf dieser Remittance Mitteilung Bitte leiten Sie Ihre VOLLER NAME: FULL KONTAKTADRESSE: Telefon- und Faxnummern: Direkt an meine E-Mail: standchart_orgb...@asia.com Mit freundlichen Grüßen, Mr. Rajesh Arora Finanzvorstand, UAE. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 5/8] scsi: ufs: creates wrapper functions for vops
2015-08-16 19:14 GMT+09:00 Yaniv Gardi : > In order to simplify the code a set of wrapper functions is created > to test and call each of the variant operations. > > Signed-off-by: Yaniv Gardi > > --- > drivers/scsi/ufs/ufs-qcom.c | 3 +- > drivers/scsi/ufs/ufshcd.c | 104 > +--- > drivers/scsi/ufs/ufshcd.h | 98 + > 3 files changed, 138 insertions(+), 67 deletions(-) > > diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c > index 64c54b7..a6b7e10 100644 > --- a/drivers/scsi/ufs/ufs-qcom.c > +++ b/drivers/scsi/ufs/ufs-qcom.c > @@ -1036,7 +1036,7 @@ void ufs_qcom_clk_scale_notify(struct ufs_hba *hba) > * The variant operations configure the necessary controller and PHY > * handshake during initialization. > */ > -static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { > +static struct ufs_hba_variant_ops ufs_hba_qcom_vops = { Why do we need to drop 'const'? > .name = "qcom", > .init = ufs_qcom_init, > .exit = ufs_qcom_exit, > @@ -1049,6 +1049,5 @@ static const struct ufs_hba_variant_ops > ufs_hba_qcom_vops = { > .suspend= ufs_qcom_suspend, > .resume = ufs_qcom_resume, > }; > -EXPORT_SYMBOL(ufs_hba_qcom_vops); In patch 8, ufs_hba_qcom_vops is exported again... -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 8/8] scsi: ufs-qcom: add QUniPro hardware support and power optimizations
2015-08-16 19:14 GMT+09:00 Yaniv Gardi : > @@ -1208,6 +1510,7 @@ static struct ufs_hba_variant_ops ufs_hba_qcom_vops = { > .resume = ufs_qcom_resume, > .dbg_register_dump = ufs_qcom_dump_dbg_regs, > }; > +EXPORT_SYMBOL(ufs_hba_qcom_vops); As I said in the view comment for the patch 5, this shouldn't be exported again. > @@ -775,6 +781,12 @@ static inline int ufshcd_vops_resume(struct ufs_hba > *hba, enum ufs_pm_op op) > return 0; > } > > +static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) > +{ > + if (hba->vops && hba->vops->dbg_register_dump) > + hba->vops->dbg_register_dump(hba); > +} > + This change should be done in the patch 7? -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 6/8] scsi: ufs: make the UFS variant a platform device
2015-08-16 19:14 GMT+09:00 Yaniv Gardi : > +/** > + * ufs_qcom_remove - set driver_data of the device to NULL > + * @pdev: pointer to platform device handle > + * > + * Always return 0 > + */ > +static int ufs_qcom_remove(struct platform_device *pdev) > +{ > + struct ufs_hba *hba = platform_get_drvdata(pdev); > + > + pm_runtime_get_sync(&(pdev)->dev); > + ufshcd_remove(hba); > + ufshcd_dealloc_host(hba); scsi_host_put (== ufshcd_dealloc_host) is already called in ufshcd_remove(). So we shouldn't call it here again. > +static struct platform_driver ufs_qcom_pltform = { > + .probe = ufs_qcom_probe, > + .remove = ufs_qcom_remove, > + .shutdown = ufs_qcom_shutdown, > + .driver = { > + .name = "ufshcd-qcom", > + .owner = THIS_MODULE, We don't need to set .owner. Please see commit 37b6fea57b4 ("scsi: ufs: drop owner assignment from platform_drivers"). > diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c > b/drivers/scsi/ufs/ufshcd-pltfrm.c > index 7db9564..20009a9 100644 > --- a/drivers/scsi/ufs/ufshcd-pltfrm.c > +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c > @@ -38,20 +38,9 @@ > #include > > #include "ufshcd.h" > +#include "ufshcd-pltfrm.h" > > static const struct of_device_id ufs_of_match[]; We can remove this forward declaration as ufs_of_match is removed below. > @@ -245,10 +234,11 @@ out: > * Returns 0 if successful > * Returns non-zero otherwise > */ > -static int ufshcd_pltfrm_suspend(struct device *dev) > +int ufshcd_pltfrm_suspend(struct device *dev) > { > return ufshcd_system_suspend(dev_get_drvdata(dev)); > } > +EXPORT_SYMBOL_GPL(ufshcd_pltfrm_suspend); > > /** > * ufshcd_pltfrm_resume - resume power management function > @@ -257,23 +247,30 @@ static int ufshcd_pltfrm_suspend(struct device *dev) > * Returns 0 if successful > * Returns non-zero otherwise > */ > -static int ufshcd_pltfrm_resume(struct device *dev) > +int ufshcd_pltfrm_resume(struct device *dev) > { > return ufshcd_system_resume(dev_get_drvdata(dev)); > } > +EXPORT_SYMBOL_GPL(ufshcd_pltfrm_resume); > > -static int ufshcd_pltfrm_runtime_suspend(struct device *dev) > +int ufshcd_pltfrm_runtime_suspend(struct device *dev) > { > return ufshcd_runtime_suspend(dev_get_drvdata(dev)); > } > -static int ufshcd_pltfrm_runtime_resume(struct device *dev) > +EXPORT_SYMBOL_GPL(ufshcd_pltfrm_runtime_suspend); > + > +int ufshcd_pltfrm_runtime_resume(struct device *dev) > { > return ufshcd_runtime_resume(dev_get_drvdata(dev)); > } > -static int ufshcd_pltfrm_runtime_idle(struct device *dev) > +EXPORT_SYMBOL_GPL(ufshcd_pltfrm_runtime_resume); > + > +int ufshcd_pltfrm_runtime_idle(struct device *dev) > { > return ufshcd_runtime_idle(dev_get_drvdata(dev)); > } > +EXPORT_SYMBOL_GPL(ufshcd_pltfrm_runtime_idle); > + > #else /* !CONFIG_PM */ > #define ufshcd_pltfrm_suspend NULL > #define ufshcd_pltfrm_resume NULL Since ufshcd_pltfrm_suspend()/resume() and ufshcd_pltfrm_runtime_*() are only defined when CONFIG_PM=y, ufs-qcom.c can't be built when !CONFIG_PM. These #ifdef should be moved to ufshcd-pltfrm.h, or we can export ufshcd_dev_pm_ops instead of the pm functions. > @@ -282,18 +279,15 @@ static int ufshcd_pltfrm_runtime_idle(struct device > *dev) > #define ufshcd_pltfrm_runtime_idle NULL > #endif /* CONFIG_PM */ > > -static void ufshcd_pltfrm_shutdown(struct platform_device *pdev) > -{ > - ufshcd_shutdown((struct ufs_hba *)platform_get_drvdata(pdev)); > -} How about exporting this function? ufs-qcom and other variant can use this. > +#ifndef UFSHCD_PLTFRM_H_ > +#define UFSHCD_PLTFRM_H_ > + > +#include "ufshcd.h" > + > +int ufshcd_pltfrm_init(struct platform_device *pdev, > + struct ufs_hba_variant_ops *vops); struct platform_device appears before including . > +/* variant specific ops structures */ > +#ifdef CONFIG_SCSI_UFS_QCOM > +extern struct ufs_hba_variant_ops ufs_hba_qcom_variant; > +#endif What is ufs_hba_qcom_variant? I can't find in kernel source and this patch series. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] ipr: Enable SIS pipe commands for SIS-32 devices.
Remove unnecessary check that disabled SIS pipe commands for SIS-32 devices. This change was sufficient to enable raw mode and send SIS pipe commands for a 57B3 device. Fixes: f8ee25d7d239 ("ipr: AF DASD raw mode implementation in ipr driver") Signed-off-by: Gabriel Krisman Bertazi --- drivers/scsi/ipr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index db0c2cf..b19719f 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -4554,7 +4554,7 @@ static ssize_t ipr_store_raw_mode(struct device *dev, spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); res = (struct ipr_resource_entry *)sdev->hostdata; if (res) { - if (ioa_cfg->sis64 && ipr_is_af_dasd_device(res)) { + if (ipr_is_af_dasd_device(res)) { res->raw_mode = simple_strtoul(buf, NULL, 10); len = strlen(buf); if (res->sdev) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] ipr: Inhibit underlength data check for AFDASD in raw mode.
Disable underlength error verification based on count of bytes actually transferred for AF DASD devices when SIS pipe mode is enabled. This avoids unexpected underlength errors when issuing some commands in raw mode. Signed-off-by: Gabriel Krisman Bertazi --- drivers/scsi/ipr.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index a9aa389..db0c2cf 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -6382,9 +6382,13 @@ static int ipr_queuecommand(struct Scsi_Host *shost, (!ipr_is_gscsi(res) || scsi_cmd->cmnd[0] == IPR_QUERY_RSRC_STATE)) { ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD; } - if (res->raw_mode && ipr_is_af_dasd_device(res)) + if (res->raw_mode && ipr_is_af_dasd_device(res)) { ioarcb->cmd_pkt.request_type = IPR_RQTYPE_PIPE; + if (scsi_cmd->underflow == 0) + ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK; + } + if (ioa_cfg->sis64) rc = ipr_build_ioadl64(ioa_cfg, ipr_cmd); else -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
isci, INTx mode, race condition
Dear all, attached are two patches for the "isci" module (CONFIG_SCSI_ISCI). Both patches apply to the current Linux kernel, retrieved by GIT (4.2.0-rc7). The first patch (init.patch) is for reproducing the problem with the "Intel(R) C600 SAS Controller" in INTx Mode, see below. The second patch (host.patch) is for fixing this problem. The problem: By applying the first patch "init.patch", the "Intel(R) C600 SAS Controller" (now abbreviated by SAS) generates level-triggered INTx Interrupts instead of (edge-triggered) MSI-X Interrupts. In the ISR (isci_intx_isr), the controller determines if the interrupt is due to a normal operation (normal interrrupt) or an error. In the case of a normal interrupt, a tasklet is scheduled that should handle the normal interrupt. However, in the ISR, the interrupts are left unmasked and the SAS device may trigger the next interrupt after the ISR has left and before the tasklet has been scheduled. Thus, with this patch "init.patch" and on my system (Intel C600 chipset series), the SAS device repeatedly level-triggers the interrupt and the tasklet to handle the interrupt never gets scheduled. This will result in a soft-lockup on the executing core. In my investigations, the above described problem occurs in all Linux kernel version starting from 3.5 and up to to-day. The fix: By applying the second patch "host.patch", the interrupts are masked in the INTx ISR in case of a normal interrupt. Thus, the scheduler has enough time to schedule the handling tasklet. In the tasklet (see sci_controller_completion_handler), the interrupts are unmasked again. Please let me know if you need any other information. Kind Regards, Stefan Signed-off-by: Stefan Fausser --- linux/drivers/scsi/isci/host.c.orig 2015-08-19 15:23:28.0 +0200 +++ linux/drivers/scsi/isci/host.c 2015-08-19 16:08:30.0 +0200 @@ -612,6 +612,7 @@ irqreturn_t isci_intx_isr(int vec, void if (sci_controller_isr(ihost)) { writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status); + writel(0xFF00, &ihost->smu_registers->interrupt_mask); tasklet_schedule(&ihost->completion_tasklet); ret = IRQ_HANDLED; } else if (sci_controller_error_isr(ihost)) { Signed-off-by: Stefan Fausser --- linux/drivers/scsi/isci/init.c.orig 2015-08-19 15:23:36.0 +0200 +++ linux/drivers/scsi/isci/init.c 2015-08-19 15:47:47.0 +0200 @@ -345,6 +345,7 @@ static int isci_setup_interrupts(struct struct isci_host *ihost; struct isci_pci_info *pci_info = to_pci_info(pdev); + goto intx; /* * Determine the number of vectors associated with this * PCI function.
[Bug 101891] mvsas prep failed, NULL pointer dereference in mvs_slot_task_free+0x5/0x1f0 [mvsas]
https://bugzilla.kernel.org/show_bug.cgi?id=101891 --- Comment #5 from Dāvis --- Success, patch indeed fixed it :) Now instead of crash I get this ↓, but everything seems to be working and no need for reboot. kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: mvsas :07:00.0: mvsas prep failed[0]! kernel: sas: Enter sas_scsi_recover_host busy: 19 failed: 19 kernel: sas: trying to find task 0x8801c9599100 kernel: sas: sas_scsi_find_task: aborting task 0x8801c9599100 kernel: sas: sas_scsi_find_task: task 0x8801c9599100 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x8801c9599100 is aborted kernel: sas: trying to find task 0x8801c9599500 kernel: sas: sas_scsi_find_task: aborting task 0x8801c9599500 kernel: sas: sas_scsi_find_task: task 0x8801c9599500 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x8801c9599500 is aborted kernel: sas: trying to find task 0x8801c9599900 kernel: sas: sas_scsi_find_task: aborting task 0x8801c9599900 kernel: sas: sas_scsi_find_task: task 0x8801c9599900 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x8801c9599900 is aborted kernel: sas: trying to find task 0x8801ba22a500 kernel: sas: sas_scsi_find_task: aborting task 0x8801ba22a500 kernel: sas: sas_scsi_find_task: task 0x8801ba22a500 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x8801ba22a500 is aborted kernel: sas: trying to find task 0x88000f686300 kernel: sas: sas_scsi_find_task: aborting task 0x88000f686300 kernel: sas: sas_scsi_find_task: task 0x88000f686300 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x88000f686300 is aborted kernel: sas: trying to find task 0x88000f687f00 kernel: sas: sas_scsi_find_task: aborting task 0x88000f687f00 kernel: sas: sas_scsi_find_task: task 0x88000f687f00 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x88000f687f00 is aborted kernel: sas: trying to find task 0x88000f687c00 kernel: sas: sas_scsi_find_task: aborting task 0x88000f687c00 kernel: sas: sas_scsi_find_task: task 0x88000f687c00 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x88000f687c00 is aborted kernel: sas: trying to find task 0x88000f686e00 kernel: sas: sas_scsi_find_task: aborting task 0x88000f686e00 kernel: sas: sas_scsi_find_task: task 0x88000f686e00 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x88000f686e00 is aborted kernel: sas: trying to find task 0x88000f686a00 kernel: sas: sas_scsi_find_task: aborting task 0x88000f686a00 kernel: sas: sas_scsi_find_task: task 0x88000f686a00 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x88000f686a00 is aborted kernel: sas: trying to find task 0x88000f687d00 kernel: sas: sas_scsi_find_task: aborting task 0x88000f687d00 kernel: sas: sas_scsi_find_task: task 0x88000f687d00 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x88000f687d00 is aborted kernel: sas: trying to find task 0x88000f686f00 kernel: sas: sas_scsi_find_task: aborting task 0x88000f686f00 kernel: sas: sas_scsi_find_task: task 0x88000f686f00 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x88000f686f00 is aborted kernel: sas: trying to find task 0x88000f687500 kernel: sas: sas_scsi_find_task: aborting task 0x88000f687500 kernel: sas: sas_scsi_find_task: task 0x88000f687500 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x88000f687500 is aborted kernel: sas: trying to find task 0x88000f687000 kernel: sas: sas_scsi_find_task: aborting task 0x88000f687000 kernel: sas: sas_scsi_find_task: task 0x88000f687000 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x88000f687000 is aborted kernel: sas: trying to find task 0x8800024f1900 kernel: sas: sas_scsi_find_task: aborting task 0x8800024f1900 kernel: sas: sas_scsi_find_task: task 0x8800024f1900 is aborted kernel: sas: sas_eh_handle_sas_errors: task 0x8800024f1900 is aborted kernel: sas: trying to find task 0x8800024f0d00 kernel: sas: sas_scsi_find_task: aborting task 0x8800024f0d00 kernel: sas: sas_
Re: [PATCH] target/qla2xxx: Honor max_data_sg_nents I/O transfer limit
Hi nab, On Thu, 13 Aug 2015, 1:45am -0700, Nicholas A. Bellinger wrote: From: Nicholas Bellinger Hi Arun, Roland & Co, Based upon the feedback from last week, here is a proper patch for target-core to honor a fabric provided SGL limit using residual count plus underflow response bit. Everything appears to be working as expected with tcm-loop LUNs with basic I/O and sg_raw to test CDB underflow, but still needs to be verified on real qla2xxx hardware over the next days for v4.2.0 code. Please review + test. Changes look good. I could not test the changes, though. I have requested internally to test this patch. Himanshu (copied) will get back with the test results (Thanks Himanshu). Regards, -Arun --nab This patch adds an optional fabric driver provided SGL limit that target-core will honor as it's own internal I/O maximum transfer length limit, as exposed by EVPD=0xb0 block limits parameters. This is required for handling cases when host I/O transfer length exceeds the requested EVPD block limits maximum transfer length. The initial user of this logic is qla2xxx, so that we can avoid having to reject I/Os from some legacy FC hosts where EVPD=0xb0 parameters are not honored. When se_cmd payload length exceeds the provided limit in target_check_max_data_sg_nents() code, se_cmd->data_length + se_cmd->prot_length are reset with se_cmd->residual_count plus underflow bit for outgoing TFO response callbacks. It also checks for existing CDB level underflow + overflow and recalculates final residual_count as necessary. Note this patch currently assumes 1:1 mapping of PAGE_SIZE per struct scatterlist entry. Reported-by: Craig Watson Cc: Craig Watson Cc: Roland Dreier Cc: Arun Easi Cc: Giridhar Malavali Cc: Andrew Vasquez Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Martin K. Petersen Signed-off-by: Nicholas Bellinger --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 5 drivers/target/target_core_spc.c | 13 +++-- drivers/target/target_core_transport.c | 51 +- include/target/target_core_fabric.h| 13 + 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 9224a06..6649809 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -1804,6 +1804,11 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = { .module = THIS_MODULE, .name = "qla2xxx", .node_acl_size = sizeof(struct tcm_qla2xxx_nacl), + /* +* XXX: Limit assumes single page per scatter-gather-list entry. +* Current maximum is ~4.9 MB per se_cmd->t_data_sg with PAGE_SIZE=4096 +*/ + .max_data_sg_nents = 1200, .get_fabric_name= tcm_qla2xxx_get_fabric_name, .tpg_get_wwn= tcm_qla2xxx_get_fabric_wwn, .tpg_get_tag= tcm_qla2xxx_get_tag, diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 556ea1b..da6130a 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -484,8 +484,8 @@ static sense_reason_t spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) { struct se_device *dev = cmd->se_dev; - int have_tp = 0; - int opt, min; + u32 mtl = 0; + int have_tp = 0, opt, min; /* * Following spc3r22 section 6.5.3 Block Limits VPD page, when @@ -516,8 +516,15 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) /* * Set MAXIMUM TRANSFER LENGTH +* +* XXX: Currently assumes single PAGE_SIZE per scatterlist for fabrics +* enforcing maximum HW scatter-gather-list entry limit */ - put_unaligned_be32(dev->dev_attrib.hw_max_sectors, &buf[8]); + if (cmd->se_tfo->max_data_sg_nents) { + mtl = (cmd->se_tfo->max_data_sg_nents * PAGE_SIZE) / + dev->dev_attrib.block_size; + } + put_unaligned_be32(min_not_zero(mtl, dev->dev_attrib.hw_max_sectors), &buf[8]); /* * Set OPTIMAL TRANSFER LENGTH diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index ce8574b..652471a1 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1074,6 +1074,55 @@ transport_set_vpd_ident(struct t10_vpd *vpd, unsigned char *page_83) } EXPORT_SYMBOL(transport_set_vpd_ident); +static sense_reason_t +target_check_max_data_sg_nents(struct se_cmd *cmd, struct se_device *dev, + unsigned int size) +{ + u32 mtl; + + if (!cmd->se_tfo->max_data_sg_nents) + return TCM_NO_SENSE; + /* +* Check if fabric enforced maximum SGL entries per I/O descriptor +* exceeds se_cmd->data_length. If