Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264695
b: refs/heads/master
c: 6b20fa9
h: refs/heads/master
i:
  264693: c0a9102
  264691: b3e13c1
  264687: 39cb746
v: v3
  • Loading branch information
Nicholas Bellinger committed Oct 24, 2011
1 parent 1e25bf9 commit bb0a76d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b937d27052e5759b1308782166fe47bc76e05b4d
refs/heads/master: 6b20fa9aaf0c2f69ee6f9648e20ab2be0206705e
20 changes: 20 additions & 0 deletions trunk/drivers/target/target_core_alua.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,32 @@ int core_emulate_report_target_port_groups(struct se_cmd *cmd)
unsigned char *buf;
u32 rd_len = 0, off = 4; /* Skip over RESERVED area to first
Target port group descriptor */
/*
* Need at least 4 bytes of response data or else we can't
* even fit the return data length.
*/
if (cmd->data_length < 4) {
pr_warn("REPORT TARGET PORT GROUPS allocation length %u"
" too small\n", cmd->data_length);
return -EINVAL;
}

buf = transport_kmap_first_data_page(cmd);

spin_lock(&su_dev->t10_alua.tg_pt_gps_lock);
list_for_each_entry(tg_pt_gp, &su_dev->t10_alua.tg_pt_gps_list,
tg_pt_gp_list) {
/*
* Check if the Target port group and Target port descriptor list
* based on tg_pt_gp_members count will fit into the response payload.
* Otherwise, bump rd_len to let the initiator know we have exceeded
* the allocation length and the response is truncated.
*/
if ((off + 8 + (tg_pt_gp->tg_pt_gp_members * 4)) >
cmd->data_length) {
rd_len += 8 + (tg_pt_gp->tg_pt_gp_members * 4);
continue;
}
/*
* PREF: Preferred target port bit, determine if this
* bit should be set for port group.
Expand Down

0 comments on commit bb0a76d

Please sign in to comment.