> On Nov 18, 2021, at 22:51, Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote: > > On 2021/11/18 23:15, Tetsuo Handa wrote: >>> On 2021/11/18 11:36, wangyangbo wrote: >>> @@ -2170,11 +2170,11 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd, >>> { >>> switch (cmd) { >>> case LOOP_CTL_ADD: >>> - return loop_add(parm); >>> + return loop_add(MINOR(parm)); >> >> Better to return -EINVAL or something if out of minor range? > > Well, this is not specific to loop devices. > Shouldn't the minor range be checked by device_add_disk() ? I just think ioctl paramter need to make sense. Perhaps block layer need add/update/del check for consistency, but as inner interface caller check is also agreeable. By the way, do other driver have similar problems?