]> www.infradead.org Git - users/jedix/linux-maple.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)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Thu, 8 Dec 2011 19:17:46 +0000 (11:17 -0800)
commite16f244d5b12c6e61b074cc0d557220dbe191f89
treee53834c8a6004e72947f2c9997e522b72e05affd
parente393afdc431b6222f07eb130810d2eb207bbe2f0
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