Vladislav Bolkhovitin 9f3c9df526 scst_lib: Avoid integer overflows
This patch fixes the following kernel oops:

[3696]: scst: scst_parse_cmd:826:Warning: expected transfer length 522240 for opcode 0x08 (handler vcdrom, target iscsi) doesn't match decoded value -2048
[3696]: scst_parse_cmd:828:Suspicious CDB:
 (h)___0__1__2__3__4__5__6__7__8__9__A__B__C__D__E__F
   0: 08 1f ff ff ff 00   ......
BUG: unable to handle kernel paging request at ffff88283597f0c8
IP: [<ffffffff8135c3af>] sg_init_table+0x5f/0x90
Call Trace:
 [<ffffffffa021eb48>] sgv_pool_alloc+0x3b8/0xbf0 [scst]
 [<ffffffffa0204c16>] scst_alloc_space+0xb6/0x290 [scst]
 [<ffffffffa01e2d28>] scst_prepare_space+0x3b8/0x6e0 [scst]
 [<ffffffffa01ef4a5>] scst_process_active_cmd+0x455/0x7e0 [scst]
 [<ffffffffa01efb22>] scst_cmd_init_done+0x2f2/0x5c0 [scst]
 [<ffffffffa0156ac2>] scst_cmd_init_stage1_done.constprop.37+0x12/0x20 [iscsi_scst]
 [<ffffffffa015d9fa>] scsi_cmnd_start+0x25a/0x550 [iscsi_scst]
 [<ffffffffa015e4b8>] cmnd_rx_start+0x148/0x1a0 [iscsi_scst]
 [<ffffffffa0161598>] process_read_io+0x3b8/0x800 [iscsi_scst]
 [<ffffffffa0161aa7>] scst_do_job_rd+0xc7/0x220 [iscsi_scst]
 [<ffffffffa016208d>] istrd+0x16d/0x2e0 [iscsi_scst]
 [<ffffffff81075bad>] kthread+0xed/0x110
 [<ffffffff816dd5bc>] ret_from_fork+0x7c/0xb0

and causes the following message to be reported instead:

[11269]: scst: scst_generic_parse:7402:***WARNING***: bufflen 16777215, data_len 16777215 or out_bufflen 0 too large for device disk12 (block size 2048)
scst_generic_parse:CDB:
 (h)___0__1__2__3__4__5__6__7__8__9__A__B__C__D__E__F
   0: 08 1f ff ff ff 00   ......

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5464 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2014-04-24 02:30:52 +00:00
2014-04-24 02:30:52 +00:00
2014-04-15 21:30:26 +00:00
2011-04-19 22:56:07 +00:00
2014-02-24 07:30:50 +00:00
2008-06-26 16:35:10 +00:00

This is the SCST development repository. It contains not a single
project SCST as one can think, but a number of them, which are divided
as the following:

1. SCST core in scst/ subdirectory

2. Administration utility for SCST core scstadmin in scstadmin/

3. Target drivers in own subdirectories qla2x00t/, iscsi-scst/, etc.

4. User space programs in usr/ subdirectory, like fileio_tgt.

5. Some various docs in doc/ subdirectory.

Those subprojects are in most cases independent from each other,
although some of them depend from the SCST core. They put in the single
repository only to simplify their development, they are released
independently.

Thus, use "make all" only if you really need to build everything.
Otherwise build only what you need, like for iSCSI-SCST:

make scst scst_install iscsi iscsi_install

For more information about each subproject see their README files.

Vladislav Bolkhovitin <vst@vlnb.net>, http://scst.sourceforge.net
Description
No description provided
Readme 33 MiB
Languages
C 90.1%
Perl 4.2%
Shell 1.8%
HTML 1.7%
Makefile 1.2%
Other 0.9%