Skip to content

Commit 81a0a2e

Browse files
committed
Merge branch 'for-7.1/block' into for-next
* for-7.1/block: scsi: bsg: fix buffer overflow in scsi_bsg_uring_cmd()
2 parents e0b1570 + 0a42ca4 commit 81a0a2e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/scsi/scsi_bsg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ static int scsi_bsg_uring_cmd(struct request_queue *q, struct io_uring_cmd *iouc
137137
return PTR_ERR(req);
138138

139139
scmd = blk_mq_rq_to_pdu(req);
140-
scmd->cmd_len = cmd->request_len;
141-
if (scmd->cmd_len > sizeof(scmd->cmnd)) {
140+
if (cmd->request_len > sizeof(scmd->cmnd)) {
142141
ret = -EINVAL;
143142
goto out_free_req;
144143
}
144+
scmd->cmd_len = cmd->request_len;
145145
scmd->allowed = SG_DEFAULT_RETRIES;
146146

147147
if (copy_from_user(scmd->cmnd, uptr64(cmd->request), cmd->request_len)) {

0 commit comments

Comments
 (0)