Commit Graph

4668 Commits

Author SHA1 Message Date
Bart Van Assche 18c63e434b qla2x00t: Fix a potential buffer overflow
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6382 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:29:04 +00:00
Bart Van Assche e2210ff40f ib_srpt, make clean: Remove all temporary files
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6381 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:28:39 +00:00
Bart Van Assche a8da0107f8 iscsiadm: Fix a resource leak
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6380 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:28:02 +00:00
Bart Van Assche ad38432332 iscsiadm: Fix strerror() argument
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6379 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:27:41 +00:00
Bart Van Assche a14df39942 iscsiadm: Do not allocate more memory than needed
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6378 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:27:18 +00:00
Bart Van Assche ff2b660264 iscsiadm: Fix a file descriptor leak in an error path
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6377 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:26:35 +00:00
Bart Van Assche f5f85b95fb iscsi-scstd: Fix a resource leak in an error path
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6376 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:26:08 +00:00
Bart Van Assche a6121b03c8 iscsi-scstd: Fix a potential file descriptor leak
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6375 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:25:42 +00:00
Bart Van Assche 74b4104994 iscsi-scstd: Avoid that Coverity complains about a use-after-free
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6374 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:25:05 +00:00
Bart Van Assche b3f49a0a17 iscsi-scstd: Annotate fall-throughs for Coverity
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6373 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:24:25 +00:00
Bart Van Assche 102d8d54c9 iscsi-scstd: Move two local variables to suppress a Coverity complaint
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6372 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:24:03 +00:00
Bart Van Assche 41caee3148 iscsi-scstd: Fix a file descriptor leak in an error path
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6371 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:23:38 +00:00
Bart Van Assche 21b60063a9 iscsi-scstd: Fix a dereference-before-null-check
Detected by Coverity.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6370 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:23:14 +00:00
Bart Van Assche b099782023 iscsi-scstd: Fix a memory leak in the iSNS code
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6369 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:22:46 +00:00
Bart Van Assche dfcb53a9b2 iscsi-scstd: Rearrange driver major number lookup code
Introduce a function for looking up the driver major number.
This patch does not change any functionality but makes the source
code easier to read and also makes it easier for Coverity to
analyze this code.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6368 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:22:14 +00:00
Bart Van Assche 165b0f1d10 iscsi-scstd: Improve create_and_open_dev() robustness
Reset 'devn' if the sscanf() return value is lower than two.
Based on a Coverity report.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6367 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:21:28 +00:00
Bart Van Assche d70b1e39c0 iscsi-scstd: Fix a dereference-before-null-check
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6366 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:20:21 +00:00
Bart Van Assche 40a90a705d isert-scst: Add address length check in isert_listen_ioctl()
Detected by Coverity.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6365 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:19:27 +00:00
Bart Van Assche 26cda0eb38 iscsi-scst: Annotate fall-through cases for Coverity
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6364 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:18:23 +00:00
Bart Van Assche 63cb4a9d40 iscsi-scst: Fix indentation
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6363 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:09:23 +00:00
Bart Van Assche 4891109301 scst_tg: Introduce scst_dg_mutex
Make target group locking more fine grained by protecting
target group related data structures via scst_dg_mutex. This
patch fixes a rare deadlock between VPD inquiry and LUN removal.
See also patch "scst: Rework sess_tgt_dev_list locking" (commit
ID 5af7d9277d).
    
INFO: task scst_uid:12943 blocked for more than 120 seconds.
Call Trace:
[<ffffffff814f9297>] schedule+0x37/0x90
[<ffffffff814fe2fc>] schedule_timeout+0x20c/0x370
[<ffffffff814fa8f7>] wait_for_completion+0xf7/0x130
[<ffffffff81083dc4>] kthread_stop+0x84/0x470
[<ffffffffa04286b8>] scst_del_threads+0xc8/0x250 [scst]
[<ffffffffa0457505>] scst_tgt_dev_stop_threads+0x185/0x1a0 [scst]
[<ffffffffa045e913>] scst_free_tgt_dev+0x103/0x280 [scst]
[<ffffffffa045fb6d>] scst_acg_del_lun+0xcd/0x270 [scst]
[<ffffffffa046fc03>] __scst_process_luns_mgmt_store+0x653/0x6b0
[scst]
[<ffffffffa046fc87>] scst_luns_mgmt_store_work_fn+0x27/0x30 [scst]
[<ffffffffa046b00d>] scst_process_sysfs_works+0xed/0x1f0 [scst]
[<ffffffffa046e4bd>] sysfs_work_thread_fn+0x13d/0x2e0 [scst]
[<ffffffff8108370a>] kthread+0x10a/0x120
[<ffffffff815001a2>] ret_from_fork+0x42/0x70
1 lock held by scst_uid/12943:
  (&scst_mutex){+.+.+.}, at: [<ffffffffa045fb4b>] scst_acg_del_lun+0xab/0x270 [scst]
INFO: task diskf00_0:19854 blocked for more than 120 seconds.
Call Trace:
[<ffffffff814f9297>] schedule+0x37/0x90
[<ffffffff814f9738>] schedule_preempt_disabled+0x18/0x30
[<ffffffff814fb1ce>] mutex_lock_nested+0x16e/0x450
[<ffffffffa0483e6f>] scst_impl_alua_configured+0x1f/0x50 [scst]
[<ffffffffa0504878>] vdisk_inq+0x68/0x2c0 [scst_vdisk]
[<ffffffffa050b05e>] vdisk_exec_inquiry+0x31e/0x440 [scst_vdisk]
[<ffffffffa0502bf6>] vdev_do_job+0x1b6/0x3c0 [scst_vdisk]
[<ffffffffa05030a9>] vdisk_exec+0x29/0x90 [scst_vdisk]
[<ffffffffa0431eb1>] scst_do_real_exec+0xa1/0x450 [scst]
[<ffffffffa043230d>] scst_exec_check_blocking+0xad/0x2b0 [scst]
[<ffffffffa043251e>] scst_exec_check_sn+0xe/0x10 [scst]
[<ffffffffa0439e75>] scst_process_active_cmd+0x3f5/0x7e0 [scst]
[<ffffffffa043b7eb>] scst_do_job_active+0xeb/0x180 [scst]
[<ffffffffa043b9bc>] scst_cmd_thread+0x13c/0x2c0 [scst]
[<ffffffff8108370a>] kthread+0x10a/0x120
[<ffffffff815001a2>] ret_from_fork+0x42/0x70
1 lock held by diskf00_0/19854:
  (&scst_mutex){+.+.+.}, at: [<ffffffffa0483e6f>] scst_impl_alua_configured+0x1f/0x50 [scst]



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6362 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:08:48 +00:00
Bart Van Assche 4b9efe2090 scst_tg: Convert dynamic into static initialization
This patch does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6361 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:07:20 +00:00
Bart Van Assche 250faea985 scst_targ: Remove dead code
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6360 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:06:18 +00:00
Bart Van Assche 76cc064b48 scst: Fix a race between scst_del_threads() and the sysfs API
kthread_stop() not only stops a thread but also frees the associated
task struct. Avoid that functions that iterate over the thread list
can encounter an invalid task structure pointer. This patch fixes the
following kernel crash:
    
general protection fault: 0000 [#2] PREEMPT SMP
RIP: 0010:[<ffffffff81080e9c>]  [<ffffffff81080e9c>] __task_pid_nr_ns+0x9c/0x1b0
Call Trace:
[<ffffffffa045ed7d>] task_pid_vnr+0xd/0x10 [scst]
[<ffffffffa0460418>] scst_tgt_dev_thread_pid_show+0x78/0xd0 [scst]
[<ffffffffa045929f>] scst_show+0xf/0x20 [scst]
[<ffffffff81231acb>] sysfs_kf_seq_show+0xab/0x130
[<ffffffff81230176>] kernfs_seq_show+0x26/0x30
[<ffffffff811daf10>] seq_read+0xe0/0x3e0
[<ffffffff81230ab5>] kernfs_fop_read+0x125/0x180
[<ffffffff811b0138>] __vfs_read+0x28/0xe0
[<ffffffff811b07ca>] vfs_read+0x8a/0x140
[<ffffffff811b1669>] SyS_read+0x49/0xb0
[<ffffffff814ffd32>] system_call_fastpath+0x16/0x7a



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6359 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:05:29 +00:00
Bart Van Assche b936c23543 qla2xxx: Declare local symbols 'static'
Additionally, remove unused code. Detected by sparse.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6358 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:03:35 +00:00
Bart Van Assche b6c00bfba1 scst_targ: Add more debug code in scst_unblock_aborted_cmds()
Use lockdep to verify that the caller holds scst_mutex if the
scst_mutex_held argument has not been set.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6357 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:01:24 +00:00
Bart Van Assche a6f9f870b3 scst_lib: Fix a use-after-free in an error path
scst_free_tgt_dev() frees the memory tgt_dev points at which means
that list_for_each_entry_safe() is needed here.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6356 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:00:40 +00:00
Bart Van Assche e31d1999f3 dev_handlers: Report invalid block sizes
If while attaching a pass-through device the READ CAPACITY command
reports an invalid sector size, log an error message.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6355 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:59:38 +00:00
Bart Van Assche 612fac9874 isert: Declare a local function static
Detected by checkpatch.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6354 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:55:52 +00:00
Bart Van Assche eb10fe3f7d iscsi-scst: Surround complex values with parentheses
Detected by checkpatch.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6353 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:55:22 +00:00
Bart Van Assche bf0fdcb36d scst_proc: Indent consistently
Detected by smatch.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6352 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:54:47 +00:00
Bart Van Assche 29d11c1ee2 scst_user: Fix indentation
Detected by smatch.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6351 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:54:14 +00:00
Bart Van Assche a0f46a0a69 scst_lib: WRITE SAME performance improvement fix
Fix the argument of the second kunmap() call. Detected by smatch.
See also patch "scst_lib: Improve WRITE SAME performance" (commit
ID a15628d683). Note: this patch does not have any impact on
64-bit architectures since kunmap() doesn't to anything on such
architectures.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6350 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:53:43 +00:00
Bart Van Assche ae2534f0a6 qla2x00t: Update how-to with instructions for 16 Gb/s HBA
Add instructions for how to download and install the 16 Gb/s FC HBA
driver. Remove the "optional step" since this step should not be
needed after various recent fixes in the SCST makefiles. Recommend
to blacklist the distro QLA initiator driver even if the kernel is
not being rebuilt.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6349 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:53:00 +00:00
Bart Van Assche dce5cbc1cb iscsi-scst/README: Add a reference
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6348 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:52:10 +00:00
Bart Van Assche 47efee04ce scst: Fix WRITE SAME parsing
Check bit 4 instead of bit 0 as the ANCHOR bit. Handle the NDOB
bit correctly.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6347 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:51:26 +00:00
Bart Van Assche 20986f4c1b scst_lib: Make a WRITE SAME debug statement more informative
If a data length mismatch has been detected, report the LBA and
the lengths that do not match.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6346 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:49:18 +00:00
Bart Van Assche 69569b0cdf fcst: Display RXID in SCST error messages
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6345 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:46:17 +00:00
Bart Van Assche a0e4cc7288 fileio: Remove dead code
There is no FUA bit in WRITE VERIFY commands. Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6344 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:45:51 +00:00
Bart Van Assche ac45265fd0 scst_local: Fix scst_local_add_target() error path
Do not return a pointer to freed memory in *out_tgt. Detected by
Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6343 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:45:15 +00:00
Bart Van Assche 1eb5498df2 scst_local: Correct error handling in scst_local_sysfs_mgmt_cmd()
Avoid that __scst_local_add_adapter() failures are ignored.
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6342 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:44:28 +00:00
Bart Van Assche 4efcfc7bfd scst: Remove dead code from scst_assign_dev_handler()
The BUG_ON(handler == NULL) statement at the start of this function
guarantees that handler != NULL. Hence remove the remaining tests of
the 'handler' pointer. Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6341 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:43:31 +00:00
Bart Van Assche f272064c12 iscsi-scst: Suppress put_page_callback patch warnings
The put_page_callback patch only improves performance on single
socket systems but not on systems with multiple CPU sockets.
Since this message is confusing to SCST users, do not print a
warning if the put_page_callback patch has not been applied.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6340 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 23:10:28 +00:00
Bart Van Assche 269d417601 scst_debug(): Avoid that debug_print_with_prefix() overflows the output buffer
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6339 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 20:23:17 +00:00
Bart Van Assche 3fe91cf714 scst_vdisk: Fix error handling in __vdev_load_mode_pages()
Avoid that unknown parameters cause __vdev_load_mode_pages() to
return 0 instead of -EINVAL. Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6338 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 20:21:22 +00:00
Bart Van Assche f6806b930c scripts/rebuild-rhel-kernel-rpm: Add RHEL 7.1 support
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6337 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 20:18:29 +00:00
Bart Van Assche 6b3f45696a RHEL 7.1: Add put_page_callback patch
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6336 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 20:17:52 +00:00
Bart Van Assche 502aef7b1b scst: Rename SERVICE_ACTION_IN into SERVICE_ACTION_IN_16
Rename this constant because it has been renamed in the Linux
kernel.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6335 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 20:16:19 +00:00
Bart Van Assche 9bfdc312d3 ib_srpt: RHEL 5 build fix
Make the ib_srpt driver build again on RHEL 5 systems. See also
r6138.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6334 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 20:15:12 +00:00
Bart Van Assche 1d58f5fd14 scst_local: RHEL 5 build fix
Add a definition of scsi_bidi_cmnd() for older kernel versions.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6333 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-16 20:14:10 +00:00