Commit Graph
2823 Commits
Author SHA1 Message Date
Gleb Chesnokov ef37ad252c scst_lib: Mark devkey string as nonstring
Fix the following GCC 15 warnings:

    initializer-string for array of ‘unsigned char’ truncates NUL
    terminator but destination lacks ‘nonstring’ attribute
    (17 chars into 16 available)

This patch doesn't change any functionality.
2025-04-18 18:54:20 +03:00
Gleb Chesnokov 86d3d4bb1d kbuild: Enable additional compiler warnings
Add additional compiler flags to improve code compliance.
2025-03-25 18:57:32 +03:00
Gleb Chesnokov 1f40850809 scst_lib: Port to Linux kernel v6.14
Support for the following block layer changes in the Linux kernel v6.14:

- 6aeb4f836480 ("block: remove bio_add_pc_page")
2025-03-25 16:53:57 +03:00
Gleb Chesnokov 191a74d127 scst: Fix recently introduced Coverity warnings
Add error handling for recently introduced SHA256 and SHA3-256 APIs.
2025-03-25 16:09:35 +03:00
Gleb Chesnokov f52ae117b8 scst: Port to Linux kernel v6.13
Support for the following changes in the Linux kernel v6.13:

- cdd30ebb1b9f ("module: Convert symbol namespace to string literal")

Fixes: https://github.com/SCST-project/scst/issues/273
2025-01-20 18:54:10 +03:00
Gleb Chesnokov 2bdc19a61f Bump the version number to 3.10.0-pre
These changes have been generated by running the following command:

$ scripts/update-version 3 10 0 -pre
2024-12-28 17:14:54 +03:00
Gleb Chesnokov a68cb8e94d Bump the version number to 3.9.0
These changes have been generated by running the following command:

$ scripts/update-version 3 9 0
2024-12-28 16:44:09 +03:00
Gleb Chesnokov 6325ba84ae scst/ChangeLog: Summarize the changes for the upcoming 3.9 release 2024-12-28 16:44:09 +03:00
Gleb Chesnokov 34b1edd045 scst.h: Fix multiple checkpatch warnings
This patch does not change any functionality.
2024-12-28 14:59:04 +03:00
Gleb Chesnokov 9728e85a5a scst_user: Fix multiple checkpatch warnings
This patch does not change any functionality.
2024-12-28 14:59:04 +03:00
Gleb Chesnokov 2c7890d765 scst_vdisk: Fix multiple checkpatch warnings
This patch does not change any functionality.
2024-12-28 14:59:04 +03:00
Gleb Chesnokov ce31d4b126 dev_handlers: Fix multiple checkpatch warnings
This patch does not change any functionality.
2024-12-28 14:59:04 +03:00
Gleb Chesnokov f265dc450f scst_lib: Move synchronize_rcu() calls out of loops to reduce overhead
This patch refactors the code by accumulating the target devices into a
temporary list and moving the synchronize_rcu() call outside of the
loops. By doing so, we reduce the number of synchronize_rcu() calls to
one, improving the efficiency of the cleanup process.

Fixes: https://github.com/SCST-project/scst/issues/229
2024-11-18 19:32:27 +03:00
Dhananjay KambleandGleb Chesnokov 70cf2f6271 scst: Unbreak the RHEL 9.5 build 2024-11-07 19:32:26 +03:00
Gleb Chesnokov 61f365f96e scst: Expand all create*_workqueue() invocations
The workqueue maintainer wants to remove the create*_workqueue() macros
because these macros always set the WQ_MEM_RECLAIM flag and because these
only support literal workqueue names. Hence this patch that replaces the
create*_workqueue() invocations with the definition of this macro. The
WQ_MEM_RECLAIM flag has been retained because I think that flag is necessary
for workqueues created by storage drivers.
2024-11-07 14:02:05 +03:00
Gleb Chesnokov 256d695afa scst: Port to Linux kernel v6.12
Support for the following changes in the Linux kernel v6.12:

- 5f60d5f6bbc1 ("move asm/unaligned.h to linux/unaligned.h")
- cb787f4ac0c2 ("[tree-wide] finally take no_llseek out")
2024-11-07 13:21:25 +03:00
Gleb Chesnokov ec1b85a7e1 scst_vdisk: Port to Linux kernel v6.11
Support for the following block layer changes in the Linux kernel v6.11:

- e9f5f44ad372 ("block: remove the blk_integrity_profile structure")
2024-09-04 12:54:26 +03:00
Gleb Chesnokov 8c6a968083 scst_lib: Port to Linux kernel v6.11
Support for the following block layer changes in the Linux kernel v6.11:

- e94b45d08b5d ("block: move dma_pad_mask into queue_limits")
2024-09-04 12:54:26 +03:00
Gleb Chesnokov 0b00e0af96 scst_lib: Fix VPD inquiry handling on incorrect LUNs
When SCST receives an INQUIRY request for an incorrect LUN, it calls
scst_set_lun_not_supported_inquiry(), which returns an inquiry buffer with
a peripheral qualifier of 011b and a peripheral device type of 1Fh.
However, for a VPD inquiry, it is unable to populate the remaining fields.
According to SPC-6, if the device server cannot return the requested data,
it should terminate with CHECK CONDITION.

Reported-by: Lev Vainblat <lev@zadarastorage.com>
2024-08-19 11:10:34 +03:00
Gleb Chesnokov ceba304d08 qla2x00t-32gbit: Avoid possible run-time warning with long model_num
The prior strlcpy() replacement of strncpy() here (which was
later replaced with strscpy()) expected pinfo->model_num (and
pinfo->model_description) to be NUL-terminated, but it is possible
it was not, as the code pattern here shows vha->hw->model_number (and
vha->hw->model_desc) being exactly 1 character larger, and the replaced
strncpy() was copying only up to the size of the source character
array. Replace this with memtostr(), which is the unambiguous way to
convert a maybe not-NUL-terminated character array into a NUL-terminated
string.

Fixes: 527e9b704c3d ("scsi: qla2xxx: Use memcpy() and strlcpy() instead of strcpy() and strncpy()")
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20240410023155.2100422-5-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
[ commit c3408c4ae041 upstream ]
2024-07-15 11:54:23 +03:00
Gleb Chesnokov 5f4eee5fc9 scst_lib: use bdev_nr_bytes(bdev) instead of i_size_read(bdev->bd_inode)
Use the helper to query the size of a block device in bytes.
2024-07-08 13:45:29 +03:00
Gleb Chesnokov ad35eef335 scst/include/backport.h: Port to Linux kernel v6.10
Support for the following fs layer changes in the Linux kernel v6.10:

- 7c98f7cb8fda ("remove call_{read,write}_iter() functions")
2024-07-08 13:45:29 +03:00
Brian MeagherandGleb Chesnokov 3fba8e48e1 scst_lib: Allow REPORT LUNS to operate on an unsupported LUN
Initiators will attempt to send LUN 0 INQUIRY and REPORT LUNS commands
when connecting to a target.

Add scst_set_lun_not_supported_report_luns to handle the case when REPORT
LUNs is sent to an unsupported LUN.

Also, in scst_set_lun_not_supported_inquiry report a valid vendor
identification string to promote better initiator behavior.
2024-05-03 12:52:30 +03:00
Gleb Chesnokov e322287f89 scst/include/backport.h: Backport DEFINE_SHOW_STORE_ATTRIBUTE()
Support the previous commit against kernel versions before v6.7.

See also commit 9cba82bba500 ("seq_file: add helper macro to define
attribute for rw file") # v6.7.
2024-05-03 12:50:49 +03:00
Gleb Chesnokov 8a1a7fab1d scst/include/backport.h: Fix the build against UEK kernels
Commit 48ef50966a ("scst/include/backport.h: Port to the latest UEK
kernels") broke the build for UEK kernel versions before v5.4.17-2136.
Fix it.
2024-05-03 12:18:43 +03:00
Gleb Chesnokov 52b5e841cf scst/include/backport.h: Fix backport for new stable kernels
This patch fixes the build against kernel versions >= 6.6.23.
2024-05-03 12:18:43 +03:00
Gleb Chesnokov 48ef50966a scst/include/backport.h: Port to the latest UEK kernels
This patch fixes the build against UEK kernel versions
5.4.17-2136.330.7.1.el8uek, 5.15.0-205.149.5.1.el9uek.
2024-05-02 17:20:01 +03:00
Gleb Chesnokov 71abad275e scst/include/backport.h: Fix backport for new stable kernels
This patch fixes the build against kernel versions >= 5.10.210.
2024-05-02 17:20:01 +03:00
Gleb Chesnokov 12f9b6e681 scst_lib, scst_vdisk: Port to Linux kernel v6.9
Support for the following block layer changes in the Linux kernel v6.9:

- f3a608827d1f ("bdev: open block device as files")
- b1211a25c4fe ("bdev: make bdev_{release, open_by_dev}() private to
  block layer")
2024-04-25 16:10:21 +03:00
Gleb Chesnokov 7bec05916c scst_vdisk: Simplify request_queue retrieval in vdisk_exec_read_capacity16
This patch simplifies the retrieval of the request_queue within the
vdisk_exec_read_capacity16 function.
2024-02-25 18:18:10 +03:00
Brian MeagherandGleb Chesnokov bb78492944 scst_vdisk: Fix recent breakage in vdisk_exec_read_capacity16
A recent commit (974001f66) added backport support for bdev_open_by_path.
This entailed adding a struct bdev_handle, but vdisk_exec_read_capacity16
attempts to lookup virt_dev->bdev_handle->bdev without regard for the fact
that if we are not using blockio then bdev_handle will be null.  Rectify
by making the lookup more robust.
2024-02-25 16:37:34 +03:00
Gleb Chesnokov ce2ba13bed scst_vdisk: Fix check for blockio device
Suppress the following (false positive) Coverity complaint:

    CID 347415: (#1 of 1): Dereference after null check (FORWARD_NULL)
    var_deref_model: Passing null pointer virt_dev->bdev_handle to
    bdev_release_backport, which dereferences it
2024-02-16 14:30:39 +03:00
Gleb Chesnokov 974001f66f scst/include/backport.h, scst_vdisk: Port to Linux kernel v6.8
Support for the following block layer changes in the Linux kernel v6.8:

- e719b4d15674 ("block: Provide bdev_open_* functions")
- cd34758c5238 ("block: Remove blkdev_get_by_*() functions")
2024-02-16 13:52:34 +03:00
Brian MeagherandGleb Chesnokov ff70c9deb7 scst_vdisk: Add active attributes support to vdisk_fileio
vdisk_blockio already supports the active attribute to facilitate
deferring opening au underlying block device.  Add a similar feature
to vdisk_fileio.
2024-02-16 13:40:08 +03:00
Bart Van AsscheandGleb Chesnokov bee5066645 scst_copy_mgr: Reject EXTENDED COPY(LID4) commands
Since SCST only supports EXTENDED COPY(LID1) commands, reject EXTENDED
COPY(LID4) commands.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2024-02-16 12:07:21 +03:00
Bart Van AsscheandGleb Chesnokov 316856caee scst_lib: Remove documentation of removed arguments
Commit 488aaeed71 ("scst_lib: Remove support for kernel versions before
3.10") removed the d_km_type and s_km_type arguments. Hence this patch that
removes the documentation for these arguments.

Fixes: 488aaeed71 ("scst_lib: Remove support for kernel versions before 3.10")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2024-02-16 12:07:21 +03:00
Gleb Chesnokov 188256792c Bump the version number to 3.9.0-pre
These changes have been generated by running the following command:

$ scripts/update-version 3 9 0 -pre
2024-01-15 15:33:45 +03:00
Gleb Chesnokov 1171841931 Bump the version number to 3.8.0
These changes have been generated by running the following command:

$ scripts/update-version 3 8 0
2024-01-15 13:59:19 +03:00
Gleb Chesnokov cee270448c scst/ChangeLog: Summarize the changes for the upcoming 3.8 release 2024-01-15 13:59:19 +03:00
Brian MeagherandGleb Chesnokov df039cb3e9 scst.h, scst, device handlers: Fix scst_replace_port_info
scst_pass_through_cmd_done can run in interrupt context, and call
scst_replace_port_info, which in turn was calling scst_lookup_tg_id.
Since scst_lookup_tg_id does a mutex_lock, we should not call it from
interrupt context.

Add scst_cmd_inquired_dev_ident and use in various locations.
2024-01-12 10:50:15 +03:00
Gleb Chesnokov b5693922e0 scst_lib: Use gfp_mask instead of GFP_KERNEL for percpu_ref_init()
Fix smatch-reported warning message:

drivers/scst/scst_lib.c:4198 scst_alloc_device() warn: use 'gfp_mask'
here instead of GFP_KERNEL?
2024-01-10 19:34:49 +03:00
Gleb Chesnokov 50e1babd39 scst/include/backport.h: Fix backport for new stable kernels
This patch fixes the build against kernel versions 5.4.263, 5.10.203,
5.15.136.
2024-01-10 19:34:49 +03:00
Gleb Chesnokov 7a48f02640 scst/include/backport.h: Port to the latest UEK 7 kernel
This patch fixes the build against UEK kernel 5.15.0-201.135.6.el9uek.
2024-01-10 19:34:49 +03:00
Gleb Chesnokov be9d368361 scst_targ: Fix shift out of bounds
This patch should fix the following UBSAN warning:

UBSAN: shift-out-of-bounds in scst/src/scst_targ.c:3912:6
shift exponent -1 is negative

Call Trace:
 <TASK>
 show_stack+0x52/0x5c
 dump_stack_lvl+0x4a/0x63
 dump_stack+0x10/0x16
 ubsan_epilogue+0x9/0x36
 __ubsan_handle_shift_out_of_bounds.cold+0x61/0xef
 scst_process_active_cmd.cold+0xf/0x2d [scst]
 scst_process_redirect_cmd+0xd4/0x2e0 [scst]
 scst_tgt_cmd_done+0x48/0x70 [scst]
 scst_local_targ_xmit_response+0x64/0x220 [scst_local]
 scst_process_active_cmd+0x891/0x2140 [scst]
 scst_process_redirect_cmd+0xd4/0x2e0 [scst]
 scst_cmd_done_local+0x80/0x110 [scst]
 dev_user_process_reply+0x597/0x1160 [scst_user]
 dev_user_ioctl+0x145/0xb23 [scst_user]
 __x64_sys_ioctl+0x95/0xd0
 do_syscall_64+0x5c/0xc0
 entry_SYSCALL_64_after_hwframe+0x62/0xcc

Reported-by: Rob Turk <robtu@rtist.nl>
2023-12-28 11:58:22 +03:00
Gleb Chesnokov 5716ffa737 scst_lib: Fix mem access after free
Fixes: https://github.com/SCST-project/scst/issues/204
2023-12-28 11:02:09 +03:00
Gleb Chesnokov d3da391be8 scst/include/backport.h: Unbreak the RHEL 8.9 build 2023-12-27 21:13:12 +03:00
Gleb Chesnokov 2d243a71e7 scst: Unbreak the RHEL 9.4 build
Fixes: https://github.com/SCST-project/scst/issues/201
2023-12-27 18:27:42 +03:00
Gleb Chesnokov fd88df1e25 scst_mem: Port to Linux kernel v6.7
Support for the following mm layer changes in the Linux kernel v6.7:

- c42d50aefd17 ("mm: shrinker: add infrastructure for dynamically
  allocating shrinker")
2023-12-27 18:02:30 +03:00
Gleb Chesnokov 12fd0ea93e scst/include/backport.h: Backport some debugfs functions
Support the previous commit against kernel versions before v5.0.

See also commit ff9fb72bc077 ("debugfs: return error values,
not NULL") # v5.0.
2023-10-10 15:10:02 +03:00
Gleb Chesnokov 60c26136bf scst/include/backport.h: Unbreak the RHEL 9.3 build
Fixes: https://github.com/SCST-project/scst/issues/167
2023-10-09 09:46:21 +03:00