]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
scsi: csiostor: Avoid content leaks and casts
authorKees Cook <keescook@chromium.org>
Tue, 9 May 2017 22:34:44 +0000 (15:34 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 13 Jun 2017 00:48:05 +0000 (20:48 -0400)
commit42c335f7e67029d2e01711f2f2bc6252277c8993
tree5be56bd6563cbe8ea68bf7677013afb10a7e4226
parent2371cd90abe3fa1b88e15111abf2cc0a26db6e52
scsi: csiostor: Avoid content leaks and casts

When copying attributes, the len argument was padded out and the
resulting memcpy() would copy beyond the end of the source buffer.
Avoid this, and use size_t for val_len to avoid all the casts.
Similarly, avoid source buffer casts and use void *.

Additionally enforces val_len can be represented by u16 and that the DMA
buffer was not overflowed. Fixes the size of mfa, which is not
FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN (but it will be padded up to 4). This
was noticed by the future CONFIG_FORTIFY_SOURCE checks.

Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/csiostor/csio_lnode.c