Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ublk: check cmd_op first

In preparation for skipping some of the other checks for certain IO
opcodes, move the cmd_op check earlier.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250620151008.3976463-4-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
5af8b36f 7ba962f4

+6 -6
+6 -6
drivers/block/ublk_drv.c
··· 2194 2194 struct ublk_io *io; 2195 2195 u32 cmd_op = cmd->cmd_op; 2196 2196 unsigned tag = ub_cmd->tag; 2197 - int ret = -EINVAL; 2198 2197 struct request *req; 2198 + int ret; 2199 2199 2200 2200 pr_devel("%s: received: cmd op %d queue %d tag %d result %d\n", 2201 2201 __func__, cmd->cmd_op, ub_cmd->q_id, tag, 2202 2202 ub_cmd->result); 2203 2203 2204 + ret = ublk_check_cmd_op(cmd_op); 2205 + if (ret) 2206 + goto out; 2207 + 2208 + ret = -EINVAL; 2204 2209 if (ub_cmd->q_id >= ub->dev_info.nr_hw_queues) 2205 2210 goto out; 2206 2211 ··· 2238 2233 ^ (_IOC_NR(cmd_op) == UBLK_IO_NEED_GET_DATA)) 2239 2234 goto out; 2240 2235 2241 - ret = ublk_check_cmd_op(cmd_op); 2242 - if (ret) 2243 - goto out; 2244 - 2245 - ret = -EINVAL; 2246 2236 switch (_IOC_NR(cmd_op)) { 2247 2237 case UBLK_IO_REGISTER_IO_BUF: 2248 2238 return ublk_register_io_buf(cmd, ubq, io, ub_cmd->addr, issue_flags);