platform/kernel/linux-starfive.git
16 months agoscsi: megaraid: Fix mega_cmd_done() CMDID_INT_CMDS
Danila Chernetsov [Fri, 17 Mar 2023 17:51:09 +0000 (17:51 +0000)]
scsi: megaraid: Fix mega_cmd_done() CMDID_INT_CMDS

When cmdid == CMDID_INT_CMDS, the 'cmds' pointer is NULL but is
dereferenced below.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 0f2bb84d2a68 ("[SCSI] megaraid: simplify internal command handling")
Signed-off-by: Danila Chernetsov <listdansp@mail.ru>
Link: https://lore.kernel.org/r/20230317175109.18585-1-listdansp@mail.ru
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoMerge patch series "Constify most SCSI host templates"
Martin K. Petersen [Sat, 25 Mar 2023 00:13:03 +0000 (20:13 -0400)]
Merge patch series "Constify most SCSI host templates"

Bart Van Assche <bvanassche@acm.org> says:

It helps humans and the compiler if it is made explicit that SCSI host
templates are not modified. Hence this patch series that constifies most
SCSI host templates. Please consider this patch series for the next merge
window.

Link: https://lore.kernel.org/r/20230322195515.1267197-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: usb: uas: Declare two host templates and host template pointers const
Bart Van Assche [Wed, 22 Mar 2023 19:55:15 +0000 (12:55 -0700)]
scsi: usb: uas: Declare two host templates and host template pointers const

Improve source code documentation by constifying host templates that are
not modified.

Acked-by: Alan Stern <stern@rowland.harvard.edu> (for usb-storage)
Acked-by: Oliver Neukum <oneukum@suse.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Oliver Neukum <oneukum@suse.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-81-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: ufs: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:14 +0000 (12:55 -0700)]
scsi: ufs: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-80-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: tcm-loop: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:13 +0000 (12:55 -0700)]
scsi: target: tcm-loop: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-79-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: rts5208: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:12 +0000 (12:55 -0700)]
scsi: rts5208: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-78-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: xen-scsifront: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:11 +0000 (12:55 -0700)]
scsi: xen-scsifront: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-77-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: wd719x: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:10 +0000 (12:55 -0700)]
scsi: wd719x: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-76-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: virtio-scsi: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:09 +0000 (12:55 -0700)]
scsi: virtio-scsi: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-75-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: sym53c8xx: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:08 +0000 (12:55 -0700)]
scsi: sym53c8xx: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-74-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: stex: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:07 +0000 (12:55 -0700)]
scsi: stex: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-73-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: snic: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:06 +0000 (12:55 -0700)]
scsi: snic: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-72-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: smartpqi: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:05 +0000 (12:55 -0700)]
scsi: smartpqi: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-71-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: sgiwd93: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:04 +0000 (12:55 -0700)]
scsi: sgiwd93: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-70-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: qlogicpti: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:03 +0000 (12:55 -0700)]
scsi: qlogicpti: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-69-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: qla2xxx: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:02 +0000 (12:55 -0700)]
scsi: qla2xxx: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-68-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: qla1280: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:01 +0000 (12:55 -0700)]
scsi: qla1280: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-67-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: ps3rom: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:55:00 +0000 (12:55 -0700)]
scsi: ps3rom: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Tested-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-66-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: ppa: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:59 +0000 (12:54 -0700)]
scsi: ppa: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-65-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: pmcraid: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:58 +0000 (12:54 -0700)]
scsi: pmcraid: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-64-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: pcmcia-pm8001: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:57 +0000 (12:54 -0700)]
scsi: pcmcia-pm8001: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Acked-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-63-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: pcmcia-sym53c500: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:56 +0000 (12:54 -0700)]
scsi: pcmcia-sym53c500: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-62-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: nsp32: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:55 +0000 (12:54 -0700)]
scsi: nsp32: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-61-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: myrs: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:54 +0000 (12:54 -0700)]
scsi: myrs: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-60-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: myrb: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:53 +0000 (12:54 -0700)]
scsi: myrb: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-59-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: mvumi: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:52 +0000 (12:54 -0700)]
scsi: mvumi: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-58-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: mvsas: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:51 +0000 (12:54 -0700)]
scsi: mvsas: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-57-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: mvme147: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:50 +0000 (12:54 -0700)]
scsi: mvme147: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-56-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: mpt3sas: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:49 +0000 (12:54 -0700)]
scsi: mpt3sas: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-55-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: mpi3mr: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:48 +0000 (12:54 -0700)]
scsi: mpi3mr: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-54-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: mesh: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:47 +0000 (12:54 -0700)]
scsi: mesh: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-53-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: megaraid: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:46 +0000 (12:54 -0700)]
scsi: megaraid: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-52-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: mac53c94: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:45 +0000 (12:54 -0700)]
scsi: mac53c94: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-51-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: iscsi: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:44 +0000 (12:54 -0700)]
scsi: iscsi: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-50-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: isci: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:43 +0000 (12:54 -0700)]
scsi: isci: Declare SCSI host template const

Make it explicit that the ISCI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-49-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: ipr: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:42 +0000 (12:54 -0700)]
scsi: ipr: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-48-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: initio: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:41 +0000 (12:54 -0700)]
scsi: initio: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-47-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: imm: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:40 +0000 (12:54 -0700)]
scsi: imm: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-46-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: ibmvfc: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:39 +0000 (12:54 -0700)]
scsi: ibmvfc: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Acked-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-45-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: hptiop: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:38 +0000 (12:54 -0700)]
scsi: hptiop: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-44-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: hpsa: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:37 +0000 (12:54 -0700)]
scsi: hpsa: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-43-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: hisi_sas: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:36 +0000 (12:54 -0700)]
scsi: hisi_sas: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Acked-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-42-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: gvp11: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:35 +0000 (12:54 -0700)]
scsi: gvp11: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-41-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: NCR5380: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:34 +0000 (12:54 -0700)]
scsi: NCR5380: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-40-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: fdomain: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:33 +0000 (12:54 -0700)]
scsi: fdomain: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-39-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: qedf: Declare host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:32 +0000 (12:54 -0700)]
scsi: qedf: Declare host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-38-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: fnic: Declare host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:31 +0000 (12:54 -0700)]
scsi: fnic: Declare host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-37-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: fcoe: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:30 +0000 (12:54 -0700)]
scsi: fcoe: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-36-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: esp_scsi: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:29 +0000 (12:54 -0700)]
scsi: esp_scsi: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-35-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: esas2r: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:28 +0000 (12:54 -0700)]
scsi: esas2r: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-34-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: elx: efct: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:27 +0000 (12:54 -0700)]
scsi: elx: efct: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-33-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: dmx3191d: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:26 +0000 (12:54 -0700)]
scsi: dmx3191d: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-32-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: dc395x: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:25 +0000 (12:54 -0700)]
scsi: dc395x: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-31-bvanassche@acm.org
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: atp870u: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:24 +0000 (12:54 -0700)]
scsi: atp870u: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-30-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: powertec: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:23 +0000 (12:54 -0700)]
scsi: powertec: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-29-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: oak: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:22 +0000 (12:54 -0700)]
scsi: oak: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-28-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: eesox: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:21 +0000 (12:54 -0700)]
scsi: eesox: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-27-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: cumana: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:20 +0000 (12:54 -0700)]
scsi: cumana: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-26-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: aha1740: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:19 +0000 (12:54 -0700)]
scsi: aha1740: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-25-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: arxescsi: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:18 +0000 (12:54 -0700)]
scsi: arxescsi: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-24-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: acornscsi: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:17 +0000 (12:54 -0700)]
scsi: acornscsi: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-23-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: arcmsr: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:16 +0000 (12:54 -0700)]
scsi: arcmsr: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-22-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: aic94xx: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:15 +0000 (12:54 -0700)]
scsi: aic94xx: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-21-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: aha1542: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:14 +0000 (12:54 -0700)]
scsi: aha1542: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-20-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: aha152x: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:13 +0000 (12:54 -0700)]
scsi: aha152x: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-19-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: advansys: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:12 +0000 (12:54 -0700)]
scsi: advansys: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-18-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: aacraid: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:11 +0000 (12:54 -0700)]
scsi: aacraid: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-17-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: a3000: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:10 +0000 (12:54 -0700)]
scsi: a3000: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-16-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: a2091: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:09 +0000 (12:54 -0700)]
scsi: a2091: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-15-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: a100u2w: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:08 +0000 (12:54 -0700)]
scsi: a100u2w: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-14-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: BusLogic: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:07 +0000 (12:54 -0700)]
scsi: BusLogic: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Acked-by: Khalid Aziz <khalid@gonehiking.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-13-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: 3w-xxxx: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:06 +0000 (12:54 -0700)]
scsi: 3w-xxxx: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-12-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: 3w-sas: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:05 +0000 (12:54 -0700)]
scsi: 3w-sas: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-11-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: 3w-9xxx: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:04 +0000 (12:54 -0700)]
scsi: 3w-9xxx: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-10-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: zfcp: Declare SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:03 +0000 (12:54 -0700)]
scsi: zfcp: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Acked-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-9-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: message: fusion: Declare SCSI host template members const
Bart Van Assche [Wed, 22 Mar 2023 19:54:02 +0000 (12:54 -0700)]
scsi: message: fusion: Declare SCSI host template members const

Make it explicit that the SCSI host templates are not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-8-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: RDMA/srp: Declare the SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:01 +0000 (12:54 -0700)]
scsi: RDMA/srp: Declare the SCSI host template const

Make it explicit that the SRP host template is not modified.

Acked-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-7-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: firewire: sbp2: Declare the SCSI host template const
Bart Van Assche [Wed, 22 Mar 2023 19:54:00 +0000 (12:54 -0700)]
scsi: firewire: sbp2: Declare the SCSI host template const

Make it explicit that the sbp2 host template it not modified.

Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-6-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: ata: Declare SCSI host templates const
Bart Van Assche [Wed, 22 Mar 2023 19:53:59 +0000 (12:53 -0700)]
scsi: ata: Declare SCSI host templates const

Make it explicit that ATA host templates are not modified.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com> (for DWC AHCI SATA)
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com> (for Tegra)
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-5-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: core: Declare SCSI host template pointer members const
Bart Van Assche [Wed, 22 Mar 2023 19:53:58 +0000 (12:53 -0700)]
scsi: core: Declare SCSI host template pointer members const

Declare the SCSI host template pointer members const and also the remaining
SCSI host template pointers in the SCSI core.

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-4-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: core: Declare most SCSI host template pointers const
Bart Van Assche [Wed, 22 Mar 2023 19:53:57 +0000 (12:53 -0700)]
scsi: core: Declare most SCSI host template pointers const

Prepare for constifying most SCSI host template pointers by constifying the
SCSI host template pointer arguments and variables in the SCSI core.

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-3-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: qla2xxx: Refer directly to the qla2xxx_driver_template
Bart Van Assche [Wed, 22 Mar 2023 19:53:56 +0000 (12:53 -0700)]
scsi: qla2xxx: Refer directly to the qla2xxx_driver_template

Access the qla2xxx_driver_template data structure directly instead of via
the host pointer. This patch prepares for declaring the 'hostt' pointer
const.

Cc: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-2-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoMerge patch series "arcmsr fixes"
Martin K. Petersen [Fri, 24 Mar 2023 21:57:19 +0000 (17:57 -0400)]
Merge patch series "arcmsr fixes"

Ching Huang <ching2048@areca.com.tw> says:

The following patches were made over mkp's 6.4/scsi-staging

This series comtain some fixes:

 - Deprecate arcmsr_pci_unmap_dma()

 - Fix ADAPTER_TYPE_B 64-bit DMA compatibility issue

 - Fix reading buffer empty length error

 - Add driver proc_name

 - Update driver's version to v1.50.00.13-20230206

Link: https://lore.kernel.org/r/6f3eb04dbe89d2b9f239600dd2c575227f3c0afc.camel@areca.com.tw
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: arcmsr: Update driver version
ching Huang [Wed, 22 Mar 2023 17:27:51 +0000 (01:27 +0800)]
scsi: arcmsr: Update driver version

Update driver version to v1.50.00.13-20230206.

Signed-off-by: ching Huang <ching2048@areca.com.tw>
Link: https://lore.kernel.org/r/8022803536481106bbeca2f8eb33712668f41217.camel@areca.com.tw
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: arcmsr: Add driver proc_name
ching Huang [Wed, 22 Mar 2023 17:24:41 +0000 (01:24 +0800)]
scsi: arcmsr: Add driver proc_name

Add driver proc_name.

Signed-off-by: ching Huang <ching2048@areca.com.tw>
Link: https://lore.kernel.org/r/045a0b360bd963987d9be08c1f0f785b47724caf.camel@areca.com.tw
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: arcmsr: Fix reading empty buffer length
ching Huang [Wed, 22 Mar 2023 17:20:35 +0000 (01:20 +0800)]
scsi: arcmsr: Fix reading empty buffer length

Fix empty buffer length error which causes ARECA CLI app command timeout.

Signed-off-by: ching Huang <ching2048@areca.com.tw>
Link: https://lore.kernel.org/r/4aec4385abc6eab10b575c28130ec615a144492d.camel@areca.com.tw
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: arcmsr: Fix ADAPTER_TYPE_B 64-bit DMA compatibility issue
ching Huang [Wed, 22 Mar 2023 17:13:20 +0000 (01:13 +0800)]
scsi: arcmsr: Fix ADAPTER_TYPE_B 64-bit DMA compatibility issue

Fix ADAPTER_TYPE_B 64-bit DMA compatibility issue on some motherboards.

Signed-off-by: ching Huang <ching2048@areca.com.tw>
Link: https://lore.kernel.org/r/81c1f98819dfdfa18ae4d3b854b7733af9d34ea5.camel@areca.com.tw
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: arcmsr: Deprecate using arcmsr_pci_unmap_dma()
ching Huang [Wed, 22 Mar 2023 17:07:47 +0000 (01:07 +0800)]
scsi: arcmsr: Deprecate using arcmsr_pci_unmap_dma()

Stop using arcmsr_pci_unmap_dma() and call scsi_dma_unmap() directly.

Signed-off-by: ching Huang <ching2048@areca.com.tw>
Link: https://lore.kernel.org/r/17c235f2fff960aefea33b50039e214f42164130.camel@areca.com.tw
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: scsi_debug: Remove redundant driver match function
Lizhe [Sun, 19 Mar 2023 04:27:32 +0000 (12:27 +0800)]
scsi: scsi_debug: Remove redundant driver match function

If there is no driver match function, the driver core assumes that each
candidate pair (driver, device) matches, see driver_match_device().

Drop the pseudo_lld bus match function that always returned 1. This results
in the same behaviour as when there is no match function.

[mkp+jgg: patch description]

Signed-off-by: Lizhe <sensor1010@163.com>
Link: https://lore.kernel.org/r/20230319042732.278691-1-sensor1010@163.com
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoMerge patch series "target: TMF and recovery fixes"
Martin K. Petersen [Fri, 24 Mar 2023 21:39:15 +0000 (17:39 -0400)]
Merge patch series "target: TMF and recovery fixes"

Mike Christie <michael.christie@oracle.com> says:

The following patches apply over Martin's 6.4 branches and Linus's tree.
They fix a couple regressions in iscsit that occur when there are TMRs
executing and a connection is closed. It also includes Dimitry's fixes in
related code paths for cmd cleanup when ERL2 is used and the write pending
hang during conn cleanup.

This version of the patchset brings it back to just regressions and fixes
for bugs we have a lot of users hitting. I'm going to fix isert and get it
hooked into iscsit properly in a second patchset, because this one was
getting so large. I've also moved my cleanup type of patches for a 3rd
patchset.

Link: https://lore.kernel.org/r/20230319015620.96006-1-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: iscsi: Handle abort for WRITE_PENDING cmds
Dmitry Bogdanov [Sun, 19 Mar 2023 01:56:20 +0000 (20:56 -0500)]
scsi: target: iscsi: Handle abort for WRITE_PENDING cmds

Sometimes an initiator does not send data for a WRITE command and tries to
abort it. The abort hangs waiting for frontend driver completion. iSCSI
driver waits for data and that timeout eventually initiates connection
reinstatment. The connection closing releases the commands in the
connection, but those aborted commands still did not handle the abort and
did not decrease a command ref counter. Because of that the connection
reinstatement hangs indefinitely and prevents re-login for that initiator.

Add handling in TCM of the abort for the WRITE_PENDING commands at
connection closing moment to make it possible to release them.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
[mnc: Rebase and expand comment]
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230319015620.96006-10-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: iscsit: Fix TAS handling during conn cleanup
Mike Christie [Sun, 19 Mar 2023 01:56:19 +0000 (20:56 -0500)]
scsi: target: iscsit: Fix TAS handling during conn cleanup

Fix a bug added in commit f36199355c64 ("scsi: target: iscsi: Fix cmd abort
fabric stop race").

If CMD_T_TAS is set on the se_cmd we must call iscsit_free_cmd() to do the
last put on the cmd and free it, because the connection is down and we will
not up sending the response and doing the put from the normal I/O
path.

Add a check for CMD_T_TAS in iscsit_release_commands_from_conn() so we now
detect this case and run iscsit_free_cmd().

Fixes: f36199355c64 ("scsi: target: iscsi: Fix cmd abort fabric stop race")
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230319015620.96006-9-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: Fix multiple LUN_RESET handling
Mike Christie [Sun, 19 Mar 2023 01:56:18 +0000 (20:56 -0500)]
scsi: target: Fix multiple LUN_RESET handling

This fixes a bug where an initiator thinks a LUN_RESET has cleaned up
running commands when it hasn't. The bug was added in commit 51ec502a3266
("target: Delete tmr from list before processing").

The problem occurs when:

 1. We have N I/O cmds running in the target layer spread over 2 sessions.

 2. The initiator sends a LUN_RESET for each session.

 3. session1's LUN_RESET loops over all the running commands from both
    sessions and moves them to its local drain_task_list.

 4. session2's LUN_RESET does not see the LUN_RESET from session1 because
    the commit above has it remove itself. session2 also does not see any
    commands since the other reset moved them off the state lists.

 5. sessions2's LUN_RESET will then complete with a successful response.

 6. sessions2's inititor believes the running commands on its session are
    now cleaned up due to the successful response and cleans up the running
    commands from its side. It then restarts them.

 7. The commands do eventually complete on the backend and the target
    starts to return aborted task statuses for them. The initiator will
    either throw a invalid ITT error or might accidentally lookup a new
    task if the ITT has been reallocated already.

Fix the bug by reverting the patch, and serialize the execution of
LUN_RESETs and Preempt and Aborts.

Also prevent us from waiting on LUN_RESETs in core_tmr_drain_tmr_list,
because it turns out the original patch fixed a bug that was not
mentioned. For LUN_RESET1 core_tmr_drain_tmr_list can see a second
LUN_RESET and wait on it. Then the second reset will run
core_tmr_drain_tmr_list and see the first reset and wait on it resulting in
a deadlock.

Fixes: 51ec502a3266 ("target: Delete tmr from list before processing")
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230319015620.96006-8-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: iscsit: Free cmds before session free
Dmitry Bogdanov [Sun, 19 Mar 2023 01:56:17 +0000 (20:56 -0500)]
scsi: target: iscsit: Free cmds before session free

Commands from recovery entries are freed after session has been closed.
That leads to use-after-free at command free or NPE with such call trace:

Time2Retain timer expired for SID: 1, cleaning up iSCSI session.
BUG: kernel NULL pointer dereference, address: 0000000000000140
RIP: 0010:sbitmap_queue_clear+0x3a/0xa0
Call Trace:
 target_release_cmd_kref+0xd1/0x1f0 [target_core_mod]
 transport_generic_free_cmd+0xd1/0x180 [target_core_mod]
 iscsit_free_cmd+0x53/0xd0 [iscsi_target_mod]
 iscsit_free_connection_recovery_entries+0x29d/0x320 [iscsi_target_mod]
 iscsit_close_session+0x13a/0x140 [iscsi_target_mod]
 iscsit_check_post_dataout+0x440/0x440 [iscsi_target_mod]
 call_timer_fn+0x24/0x140

Move cleanup of recovery enrties to before session freeing.

Reported-by: Forza <forza@tnonline.net>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230319015620.96006-7-michael.christie@oracle.com
Reviewed-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: iscsit: Stop/wait on cmds during conn close
Mike Christie [Sun, 19 Mar 2023 01:56:16 +0000 (20:56 -0500)]
scsi: target: iscsit: Stop/wait on cmds during conn close

This fixes a bug added in commit f36199355c64 ("scsi: target: iscsi: Fix
cmd abort fabric stop race").

If we have multiple sessions to the same se_device we can hit a race where
a LUN_RESET on one session cleans up the se_cmds from under another
session which is being closed. This results in the closing session freeing
its conn/session structs while they are still in use.

The bug is:

 1. Session1 has IO se_cmd1.

 2. Session2 can also have se_cmds for I/O and optionally TMRs for ABORTS
    but then gets a LUN_RESET.

 3. The LUN_RESET on session2 sees the se_cmds on session1 and during the
    drain stages marks them all with CMD_T_ABORTED.

 4. session1 is now closed so iscsit_release_commands_from_conn() only sees
    se_cmds with the CMD_T_ABORTED bit set and returns immediately even
    though we have outstanding commands.

 5. session1's connection and session are freed.

 6. The backend request for se_cmd1 completes and it accesses the freed
    connection/session.

This hooks the iscsit layer into the cmd counter code, so we can wait for
all outstanding se_cmds before freeing the connection.

Fixes: f36199355c64 ("scsi: target: iscsi: Fix cmd abort fabric stop race")
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230319015620.96006-6-michael.christie@oracle.com
Reviewed-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: iscsit: isert: Alloc per conn cmd counter
Mike Christie [Sun, 19 Mar 2023 01:56:15 +0000 (20:56 -0500)]
scsi: target: iscsit: isert: Alloc per conn cmd counter

This has iscsit allocate a per conn cmd counter and converts iscsit/isert
to use it instead of the per session one.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230319015620.96006-5-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: Pass in cmd counter to use during cmd setup
Mike Christie [Sun, 19 Mar 2023 01:56:14 +0000 (20:56 -0500)]
scsi: target: Pass in cmd counter to use during cmd setup

Allow target_get_sess_cmd() users to pass in the cmd counter they want to
use. Right now we pass in the session's cmd counter but in a subsequent
commit iSCSI will switch from per session to per conn.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230319015620.96006-4-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: Move cmd counter allocation
Mike Christie [Sun, 19 Mar 2023 01:56:13 +0000 (20:56 -0500)]
scsi: target: Move cmd counter allocation

iSCSI needs to allocate its cmd counter per connection for MCS support
where we need to stop and wait on commands running on a connection instead
of per session. This moves the cmd counter allocation to
target_setup_session() which is used by drivers that need the stop+wait
behavior per session.

xcopy doesn't need stop+wait at all, so we will be OK moving the cmd
counter allocation outside of transport_init_session().

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230319015620.96006-3-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: Move sess cmd counter to new struct
Mike Christie [Sun, 19 Mar 2023 01:56:12 +0000 (20:56 -0500)]
scsi: target: Move sess cmd counter to new struct

iSCSI needs to wait on outstanding commands like how SRP and the FC/FCoE
drivers do. It can't use target_stop_session() because for MCS support we
can't stop the entire session during recovery because if other connections
are OK then we want to be able to continue to execute I/O on them.

Move the per session cmd counters to a new struct so iSCSI can allocate
them per connection. The xcopy code can also just not allocate in the
future since it doesn't need to track commands.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230319015620.96006-2-michael.christie@oracle.com
Reviewed-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 months agoscsi: target: uapi: Replace fake flex-array with flexible-array member
Gustavo A. R. Silva [Fri, 17 Mar 2023 16:59:48 +0000 (10:59 -0600)]
scsi: target: uapi: Replace fake flex-array with flexible-array member

Zero-length arrays as fake flexible arrays are deprecated and we are moving
towards adopting C99 flexible-array members instead.

Address the following warning found with GCC-13 and -fstrict-flex-arrays=3
enabled:

CC      drivers/target/target_core_user.o
drivers/target/target_core_user.c: In function ‘queue_cmd_ring’:
drivers/target/target_core_user.c:1096:15: warning: array subscript 0 is outside array bounds of ‘struct iovec[0]’ [-Warray-bounds=]
 1096 |         iov = &entry->req.iov[0];
      |               ^~~~~~~~~~~~~~~~~~
In file included from drivers/target/target_core_user.c:31:
./include/uapi/linux/target_core_user.h:122:38: note: while referencing ‘iov’
  122 |                         struct iovec iov[0];
      |                                      ^~~

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines
on memcpy() and help us make progress towards globally enabling
-fstrict-flex-arrays=3 [1].

Link: https://github.com/KSPP/linux/issues/21
Link: https://github.com/KSPP/linux/issues/270
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/ZBSchMvTdl7VObKI@work
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>