Commit Graph

6793 Commits

Author SHA1 Message Date
Bart Van Assche
af498fafdd nightly build: Update kernel versions
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8981 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-25 18:17:22 +00:00
Bart Van Assche
51dc30f27b ib_srpt: Fix the build for kernel versions before v5.3
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8980 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-24 15:57:29 +00:00
Bart Van Assche
6077ad2b7b scst/include/backport.h: Backport the MIN_NICE definition
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8979 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 23:48:56 +00:00
Bart Van Assche
67fad5fb7b ib_srpt: Backport the max_sge_delta calculation to kernel versions < v4.17
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8978 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 23:48:31 +00:00
Bart Van Assche
f4eaed79d1 scripts/generate-kernel-patch: Fix the kernel version passed to specialize-patch
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8977 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 23:46:03 +00:00
Bart Van Assche
a88046be97 qla2xxx: Minimize diffs with upstream
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8976 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:53:52 +00:00
Bart Van Assche
ac5f86c035 qla2xxx: Fix a NULL pointer dereference in an error path
[ commit 17c5f65db629a3bd95ac8eb960940b6fbb39a310 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8975 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:52:09 +00:00
Bart Van Assche
bac6ce6350 qla2xxx: Fix endianness annotations in source files
[ commit 7ffa5b939751b6638e4a99518775c8503fbb46be upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8974 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:23:17 +00:00
Bart Van Assche
3e86d771e0 qla2xxx: Fix endianness annotations in header files
Annotate members of FC protocol and firmware dump data structures as big
endian. Annotate members of RISC control structures as little endian.
Annotate mailbox registers as little endian. Annotate the mb[] arrays as
CPU-endian because communication of the mb[] values with the hardware
happens through the readw() and writew() functions. readw() converts from
__le16 to u16 and writew() converts from u16 to __le16. Annotate 'handles'
as CPU-endian because for the firmware these are opaque values.

[ commit 21038b0900d1b8728ec77d9286d7b0b57ca7b585 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8973 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:20:52 +00:00
Bart Van Assche
e2e106d53c qla2xxx: Use make_handle() instead of open-coding it
[ commit 2a4b684ab0aa2a8f8efede77ca1525042c2c0e01 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8972 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:20:22 +00:00
Bart Van Assche
80041b881e qla2xxx: Cast explicitly to uint16_t / uint32_t
Casting a pointer to void * and relying on an implicit cast from void *
to uint16_t or uint32_t suppresses sparse warnings about endianness. Hence
cast explicitly to uint16_t and uint32_t. Additionally, remove superfluous
void * casts.

[ commit ab053c09ee2066a2fe62a755f1e64dbc8eddc17c upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8971 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:19:55 +00:00
Bart Van Assche
6e9f52f1d4 qla2xxx: Change {RD,WRT}_REG_*() function names from upper case into lower case
This was suggested by Daniel Wagner.

[ commit 04474d3a1c968119e7214c312b273dee01258cad upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8970 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:19:28 +00:00
Bart Van Assche
76ab4d5949 qla2xxx: Use register names instead of register offsets
[ commit c3888416221849ed46fd35413c7a1d00ee291cbe upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8969 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:18:44 +00:00
Bart Van Assche
807e5ec091 qla2xxx: Fix the code that reads from mailbox registers
Make the MMIO accessors strongly typed such that the compiler checks
whether the accessor function is used that matches the register width. Fix
those MMIO accesses where another number of bits was read or written than
the size of the register.

[ commit 37139da1b097e06841d40a6055db64c78755aea9 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8968 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:16:57 +00:00
Bart Van Assche
641a56ec5b qla2xxx: Change two hardcoded constants into offsetof() / sizeof() expressions
[ commit e544b720ef3191cdb6d3ea2915f82973d6372bca upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8967 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:15:33 +00:00
Bart Van Assche
55bcb91c24 qla2xxx: Increase the size of struct qla_fcp_prio_cfg to FCP_PRIO_CFG_SIZE
[ commit d9ab5f1f05fc147682d4fd1f1f1c5af00b766e33 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8966 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:15:03 +00:00
Bart Van Assche
e792922328 qla2xxx: Make a gap in struct qla2xxx_offld_chain explicit
[ commit 66f86367771507c88a970644d13646f6b57e82e5 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8965 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:14:18 +00:00
Bart Van Assche
99374b5c06 qla2xxx: Add more BUILD_BUG_ON() statements
[ commit 8a73a0e002b318d8ad79fe0e6b48e27ca30e527a upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8964 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:11:00 +00:00
Bart Van Assche
9143dc55a7 qla2xxx: Simplify the functions for dumping firmware
[ commit 8ae178760b23e2055aecf8b8a54629cec7ccc58e upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8963 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:06:52 +00:00
Bart Van Assche
ab70b43b05 qla2xxx: Fix spelling of a variable name
[ commit 246ee22583ed4847dcdd9a2f307eeca856f42882 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8962 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:05:27 +00:00
Bart Van Assche
751580bcd4 qla2xxx: Make qlafx00_process_aen() return void
[ commit 88bfdf565cbe33524308d912777f4267981d4be0 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8961 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:05:02 +00:00
Bart Van Assche
4f8071b6f7 qla2xxx: Use true, false for ha->fw_dumped
[ commit dbe6f49259dacc073c1ae602f383c177f57b1b8a upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8960 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:04:29 +00:00
Bart Van Assche
db5f6bc28b qla2xxx: Use true, false for need_mpi_reset
[ commit bda552a7741a23708823c6e87a39d9a956087ac0 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8959 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:04:02 +00:00
Bart Van Assche
630c4f49d0 qla2xxx: Make qla_set_ini_mode() return void
The return value is not used by the caller and the local variable 'rc' is
not needed. Make qla_set_ini_mode() return void and remove 'rc'.  This also
fixes the following coccicheck warning:

drivers/scsi/qla2xxx/qla_attr.c:1906:5-7: Unneeded variable: "rc".
Return "0" on line 2180

Link: https://lore.kernel.org/r/20200429140952.8240-1-yanaijie@huawei.com
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit 1b007f96f9e063f9f0b93597a4089114a89c1854 upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8958 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:03:28 +00:00
Bart Van Assche
a0c11c0790 scsi: qla2xxx: Fix failure message in qlt_disable_vha()
The following sequence of commands result in an incorrect failure message
being printed:

echo 0x7fffffff > /sys/module/qla2xxx/parameters/logging
modprobe target_core_mod
modprobe tcm_qla2xxx
mkdir /sys/kernel/config/target/qla2xxx
mkdir /sys/kernel/config/target/qla2xxx/<port-name>
mkdir /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1
echo 1 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable
echo 0 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable

qla2xxx [0001:00:02.0]-e881:1: qla2x00_wait_for_hba_online() failed

The reason of this message is the QLA_FUNCTION_FAILED code that
qla2x00_wait_for_hba_online() returns. However, qlt_disable_vha() expects
that adapter is offlined and QLA_FUNCTION_FAILED informs about the offline
state of the adapter.

The qla2x00_abort_isp() function finishes the execution at the point of
checking the adapter's mode (for example, qla_tgt_mode_enabled()) because
of the qlt_disable_vha() calls qlt_clear_mode() method. It means that
qla2x00_abort_isp() keeps vha->flags.online is equal to zero. Finally,
qla2x00_wait_for_hba_online() checks the state of this flag and returns
QLA_FUNCTION_FAILED error code.

This patch changes the failure message which informs about adapter's
offline state.

Link: https://lore.kernel.org/r/3cd0bbf3599c53b0c2a7184582d705d8b8052c8b.camel@yadro.com
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Viacheslav Dubeyko <v.dubeiko@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit 6b3d16f9875e181412401b8ab445dce83bd6fedc upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8957 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 22:01:04 +00:00
Bart Van Assche
0f40406997 scsi: qla2xxx: Fix warning after FC target reset
Currently, FC target reset finishes with the warning message:

------------[ cut here ]------------
WARNING: CPU: 238 PID: 279973 at ../drivers/scsi/qla2xxx/qla_target.c:6644 qlt_enable_vha+0x1d0/0x260 [qla2xxx]
Supported: Yes, External
CPU: 238 PID: 279973 Comm: bash Tainted: G           OE      4.12.14-197.29-default #1 SLE15-SP1
task: c000000a104c0000 task.stack: c000000b52188000
NIP: d00000001ffd7f78 LR: d00000001ffd7f6c CTR: c0000000001676c0
REGS: c000000b5218b910 TRAP: 0700   Tainted: G           OE       (4.12.14-197.29-default)
Call Trace:
qlt_enable_vha+0x1c4/0x260 [qla2xxx] (unreliable)
tcm_qla2xxx_tpg_enable_store+0xc4/0x130 [tcm_qla2xxx]
configfs_write_file+0xd0/0x190 [configfs]
__vfs_write+0x3c/0x1e0
vfs_write+0xd8/0x220
SyS_write+0x6c/0x110
system_call+0x3c/0x130
---[ end trace e32abaf6e6fee826 ]---

Link: https://lore.kernel.org/r/1d7b21bf9f7676643239eb3d60eaca7cfa505cf0.camel@yadro.com
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Viacheslav Dubeyko <v.dubeiko@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

[ commit f839544ccff60cbe534282aac68858fc3fb278ca upstream ]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8956 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 21:59:55 +00:00
Bart Van Assche
8a393a319b scst: Port to Linux kernel v5.8
Flag RQF_COPY_USER has been removed from kernel v5.8. Since that flag
only controls padding that we don't need, do not set that flag. See also
Linux kernel commit f18573abcc57 ("block: move the padding adjustment to
blk_rq_map_sg") # v2.6.26.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8955 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 17:24:09 +00:00
Bart Van Assche
75d059e9f0 iscsi-scstd: Fix a gcc 10 compiler warning
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8954 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 17:14:21 +00:00
Bart Van Assche
fa22b6d134 scst_local: Require that data buffers are page aligned
When using SG_IO it is easy to submit data buffers that do not match the
alignment requirements of vdisk_blockio. Make the submitter copy buffers
that are not aligned. See also the blk_rq_map_user() call in the Linux
kernel source file drivers/scsi/sg.c.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8953 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 17:01:40 +00:00
Bart Van Assche
2239719d8e /etc/init.d/scst: Really unload all SCST kernel modules
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8952 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 16:49:19 +00:00
Bart Van Assche
00765d8ae2 /etc/init.d/scst: Unload all SCST kernel modules
Also unload SCST kernel modules that have been loaded manually or that are
no longer referenced by /etc/scst.conf.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8951 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 16:30:42 +00:00
Bart Van Assche
9be823075d /etc/init.d/scst: Fix a shellcheck warning
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8950 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 16:18:13 +00:00
Bart Van Assche
a8d1d39613 ib_srpt: Reduce the value of max_sge_delta
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8949 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-22 17:11:27 +00:00
Bart Van Assche
fd66fe5ea4 scst, device handlers: Fix gcc 10 compiler warnings
Instead of passing an scst_data_direction value to scst_scsi_execute(), pass
a dma_data_direction value.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8948 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-21 16:48:53 +00:00
Bart Van Assche
c484c03a85 fcst: Fix an assignment in ft_recv_cmd(). This was detected by gcc 10
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8947 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-21 16:46:13 +00:00
Bart Van Assche
474af4d174 Makefile: Remove references to the mpt and mvsas_tgt drivers
This patch is a follow-up for r8622.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8946 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-20 01:04:08 +00:00
Bart Van Assche
66b2a1ff73 ib_srpt: Report retries with debug level instead of error level
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8944 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 22:21:04 +00:00
Bart Van Assche
5ff1a5efb2 scst: Add more wait list state checks
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8943 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 22:18:13 +00:00
Bart Van Assche
68b5f8ec82 scst: Backport kvmalloc_array()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8942 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 22:15:36 +00:00
Bart Van Assche
27ab15f573 ib_srpt: Use kvmalloc() instead of vmalloc()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8941 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 22:14:31 +00:00
Bart Van Assche
de74677c56 ib_srpt: Remove two superfluous assignments
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8940 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 22:13:11 +00:00
Bart Van Assche
b2536f47cf ib_srpt: Reduce QP max_recv_sge to 1
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8939 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 22:05:51 +00:00
Bart Van Assche
543989b3a2 ib_srpt: Prevent that large RDMA transfers trigger QP termination
Running fio at the initiator side with buffer size 1 MiB and when using
direct I/O triggers the following error with a ConnectX-3 and Linux kernel
v4.19 or later or CentOS 7.7 or later at the target side:

ib_srpt: RDMA t 4 for idx 20 failed with status 5. If this has not been triggered by a cable pull, please check the involved IB HCA's and cables.

This was observed with firmware version 2.42.5000 but this is probably
independent of the firmware version. Fix this by reducing the send SGE QP
limit. This patch increases ch->max_recv_sge for older kernel versions.

Reported-by: Chesnokov Gleb <Chesnokov.G@raidix.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8938 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-19 19:21:26 +00:00
Bart Van Assche
3f03d1e961 scst: Fix a recently introduced spelling error in a source code comment
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8937 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-18 14:17:00 +00:00
Bart Van Assche
e3f76c80a5 qla2x00t-32gbit: Only use 'pragma GCC diagnostic' if supported by gcc
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8936 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 21:06:37 +00:00
Bart Van Assche
fa4383ce03 scst: Document __scst_create_prepare_internal_cmd()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8935 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 21:04:03 +00:00
Bart Van Assche
21edb121be ib_srpt: Fix handling of iWARP logins
The path_rec pointer is set for IB and RoCE logins but not for iWARP
logins. Hence check the path_rec pointer before dereferencing it.

See also upstream commit cbca2442a096 ("RDMA/srpt: Fix handling of iWARP
logins") # v5.5.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8934 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 21:02:43 +00:00
Bart Van Assche
5529400fd5 .gitignore: Add built-in.a
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8933 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 20:58:38 +00:00
Bart Van Assche
1cd44e93ad scst: Fix __scst_adjust_sg_get_tail()
Set *res_sg_cnt correctly in case the scatterlist is chained. Support chained
scatterlists in the loop that calculates the number of bytes left. Fix
restoring the original SG list in case an error happens:
scst_check_restore_sg_buff() only restores the original sg list if
cmd->sg_buff_modified has been set. However, __scst_adjust_sg_get_tail()
does not set that variable. This patch fixes the following kernel complaints
triggered by COMPARE AND WRITE (see also
https://github.com/bvanassche/scst/issues/22):

scst_adjust_sg_get_tail() failed: -22
WARNING: CPU: 2 PID: 1179 at /home/bart/software/scst.git/scst/src/scst_lib.c:6860 scst_cwr_read_cmd_finished+0x954/0xb10 [scst]
CPU: 2 PID: 1179 Comm: disk011_0 Tainted: G           O      5.7.0-rc4-dbg+ #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
RIP: 0010:scst_cwr_read_cmd_finished+0x954/0xb10 [scst]
Call Trace:
 scst_finish_internal_cmd+0x1f8/0x3c0 [scst]
 scst_process_active_cmd+0x594/0x17f0 [scst]
 scst_cmd_thread+0x470/0xc30 [scst]
 kthread+0x211/0x240
 ret_from_fork+0x24/0x30

WARNING: CPU: 2 PID: 1179 at /home/bart/software/scst.git/scst/src/../include/scst.h:5030 blockio_exec_rw+0xbb2/0xe00 [scst_vdisk]
CPU: 2 PID: 1179 Comm: disk011_0 Tainted: G        W  O      5.7.0-rc4-dbg+ #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
RIP: 0010:blockio_exec_rw+0xbb2/0xe00 [scst_vdisk]
Call Trace:
 blockio_exec_write+0x9c/0x160 [scst_vdisk]
 vdev_do_job+0xe8/0x290 [scst_vdisk]
 blockio_exec+0x153/0x4b0 [scst_vdisk]
 scst_do_real_exec+0xf4/0x680 [scst]
 scst_exec_check_blocking+0x24e/0x7b0 [scst]
 scst_exec_check_sn+0x252/0x7d0 [scst]
 scst_process_active_cmd+0x9a0/0x17f0 [scst]
 scst_cmd_thread+0x37e/0xc30 [scst]
 kthread+0x211/0x240
 ret_from_fork+0x24/0x30

BUG: KASAN: slab-out-of-bounds in __scst_adjust_sg_get_tail+0x2da/0x550 [scst]
Read of size 4 at addr ffff8881dd9b93cc by task disk011_0/1179

CPU: 3 PID: 1179 Comm: disk011_0 Tainted: G        W  O      5.7.0-rc4-dbg+ #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014
Call Trace:
 dump_stack+0xa5/0xe6
 print_address_description.constprop.0+0x46/0x60
 __kasan_report.cold+0x94/0xbb
 kasan_report+0x45/0x60
 __asan_load4+0x6f/0x90
 __scst_adjust_sg_get_tail+0x2da/0x550 [scst]
 scst_cwr_read_cmd_finished+0x574/0xb10 [scst]
 scst_finish_internal_cmd+0x1f8/0x3c0 [scst]
 scst_process_active_cmd+0x594/0x17f0 [scst]
 scst_cmd_thread+0x470/0xc30 [scst]
 kthread+0x211/0x240
 ret_from_fork+0x24/0x30

Allocated by task 1549:
 save_stack+0x23/0x50
 __kasan_kmalloc.constprop.0+0xcf/0xe0
 kasan_slab_alloc+0x12/0x20
 kmem_cache_alloc+0x101/0x370
 mempool_alloc_slab+0x1b/0x20
 mempool_alloc+0xf3/0x2b0
 sg_pool_alloc+0x58/0xb0
 __sg_alloc_table+0x14e/0x1c0
 sg_alloc_table_chained+0x4f/0xf0
 scsi_init_io+0x144/0x6d0 [scsi_mod]
 scsi_queue_rq+0xabc/0xe00 [scsi_mod]
 blk_mq_dispatch_rq_list+0x6ad/0xd10
 __blk_mq_sched_dispatch_requests+0x1e9/0x2c0
 blk_mq_sched_dispatch_requests+0x8e/0xc0
 __blk_mq_run_hw_queue+0x128/0x1e0
 __blk_mq_delay_run_hw_queue+0x2dd/0x310
 blk_mq_run_hw_queue+0x145/0x1e0
 blk_mq_sched_insert_request+0x236/0x360
 blk_execute_rq_nowait+0x8e/0xa0
 blk_execute_rq+0xe1/0x160
 sg_io+0x43b/0x7a0
 scsi_cmd_ioctl+0x27a/0x3e0
 scsi_cmd_blk_ioctl+0x83/0x95
 sd_ioctl_common+0xb6/0x150 [sd_mod]
 sd_ioctl+0x20/0x80 [sd_mod]
 blkdev_ioctl+0x1c3/0x3c0
 block_ioctl+0x87/0xa0
 ksys_ioctl+0x8e/0xd0
 __x64_sys_ioctl+0x47/0x50
 do_syscall_64+0x6f/0x310
 entry_SYSCALL_64_after_hwframe+0x49/0xb3


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8932 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 20:58:06 +00:00
Bart Van Assche
edff6da84e scst: Introduce a new local variable in __scst_adjust_sg_get_tail()
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8931 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-17 20:01:47 +00:00