From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: wangyangbo <yangbonis@icloud.com>, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] loop: mask loop_control_ioctl parameter only as minor
Date: Thu, 18 Nov 2021 23:15:07 +0900 [thread overview]
Message-ID: <c685d6dc-3918-6ee5-df59-f2d814635228@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <20211118023640.32559-1-yangbonis@icloud.com>
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?
> case LOOP_CTL_REMOVE:
> - return loop_control_remove(parm);
> + return loop_control_remove(MINOR(parm));
This is bad, for this change makes
if (idx < 0) {
pr_warn("deleting an unspecified loop device is not supported.\n");
return -EINVAL;
}
dead code by masking the argument to 0-1048575 range.
> case LOOP_CTL_GET_FREE:
> - return loop_control_get_free(parm);
> + return loop_control_get_free(MINOR(parm));
This is pointless, for the passed argument is not used.
By the way, didn't someone already propose removal of this argument?
> default:
> return -ENOSYS;
> }
>
next prev parent reply other threads:[~2021-11-18 14:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-18 2:36 [PATCH] loop: mask loop_control_ioctl parameter only as minor wangyangbo
2021-11-18 14:15 ` Tetsuo Handa [this message]
2021-11-19 1:50 ` wangyangbo
2021-11-19 2:24 ` [PATCH] loop: check loop_control_ioctl parameter in range of minor wangyangbo
2021-11-19 2:32 ` [PATCH v2] " wangyangbo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c685d6dc-3918-6ee5-df59-f2d814635228@I-love.SAKURA.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yangbonis@icloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).