mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 11:11:27 +00:00
scst pr: Check buffer size before reading from that buffer
From: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4368 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2026,11 +2026,6 @@ static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
key = get_unaligned((__be64 *)&buffer[0]);
|
||||
action_key = get_unaligned((__be64 *)&buffer[8]);
|
||||
scope = (cmd->cdb[2] & 0x0f) >> 4;
|
||||
type = cmd->cdb[2] & 0x0f;
|
||||
|
||||
if (buffer_size != 24) {
|
||||
TRACE_PR("Invalid buffer size %d", buffer_size);
|
||||
scst_set_cmd_error(cmd,
|
||||
@@ -2038,6 +2033,11 @@ static void scst_pr_do_preempt(struct scst_cmd *cmd, uint8_t *buffer,
|
||||
goto out;
|
||||
}
|
||||
|
||||
key = get_unaligned((__be64 *)&buffer[0]);
|
||||
action_key = get_unaligned((__be64 *)&buffer[8]);
|
||||
scope = (cmd->cdb[2] & 0x0f) >> 4;
|
||||
type = cmd->cdb[2] & 0x0f;
|
||||
|
||||
if (!scst_pr_type_valid(type)) {
|
||||
TRACE_PR("Invalid reservation type %d", type);
|
||||
scst_set_cmd_error(cmd,
|
||||
|
||||
Reference in New Issue
Block a user