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.
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
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.
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")
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>
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 ]
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.
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.
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")
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.
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
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")
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>
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.
Support for the following mm layer changes in the Linux kernel v6.7:
- c42d50aefd17 ("mm: shrinker: add infrastructure for dynamically
allocating shrinker")