]> git.karo-electronics.de Git - karo-tx-linux.git/commit
target: Fix REPORT TARGET PORT GROUPS handling with small allocation length
authorNicholas Bellinger <nab@linux-iscsi.org>
Wed, 19 Oct 2011 06:48:04 +0000 (23:48 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:42:33 +0000 (09:42 -0800)
commitd3f7430cc10223cb13fc7943c599ae5f20030686
treedc3c9cb3b335e94623c716b7e0ce6ec3ab71e318
parentbe9f40a76784d667ef3743cd756f1cec4ea4e714
target: Fix REPORT TARGET PORT GROUPS handling with small allocation length

commit 6b20fa9aaf0c2f69ee6f9648e20ab2be0206705e upstream.

This patch fixes a bug with the handling of REPORT TARGET PORT GROUPS
containing a smaller allocation length than the payload requires causing
memory writes beyond the end of the buffer.  This patch checks for the
minimum 4 byte length for the response payload length, and also checks
upon each loop of T10_ALUA(su_dev)->tg_pt_gps_list to ensure the Target
port group and Target port descriptor list is able to fit into the
remaining allocation length.

If the response payload exceeds the allocation length length, then rd_len
is still increments to indicate to the initiator that the payload has
been truncated.

Reported-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/target/target_core_alua.c