Skip to content

Commit 49d7006

Browse files
Rob Gardnerdavem330
authored andcommitted
sparc64: Properly range check DAX completion index
Each Oracle DAX CCB has a corresponding completion area, and the required number of areas must fit within a previously allocated array of completion areas beginning at the requested index. Since the completion area index is specified by a file offset, a user can pass arbitrary values, including negative numbers. So the index must be thoroughly range checked to prevent access to addresses outside the bounds of the allocated completion area array. The index cannot be negative, and it cannot exceed the total array size, less the number of CCBs requested. The old code did not check for negative values and was off by one on the upper bound. Signed-off-by: Rob Gardner <[email protected]> Signed-off-by: Jonathan Helman <[email protected]> Reported-by: Linus Torvalds <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a68277b commit 49d7006

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/sbus/char/oradax.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ static int dax_ccb_exec(struct dax_ctx *ctx, const char __user *buf,
880880
dax_dbg("args: ccb_buf_len=%ld, idx=%d", count, idx);
881881

882882
/* for given index and length, verify ca_buf range exists */
883-
if (idx + nccbs >= DAX_CA_ELEMS) {
883+
if (idx < 0 || idx > (DAX_CA_ELEMS - nccbs)) {
884884
ctx->result.exec.status = DAX_SUBMIT_ERR_NO_CA_AVAIL;
885885
return 0;
886886
}

0 commit comments

Comments
 (0)