Re: [RFD w/info-PATCH] device arguments from lookup, partion code

Alexander Viro
2001-05-21T22:23:09Z

On Mon, 21 May 2001, Linus Torvalds wrote:

> It shouldn't be impossible to do the same thing to ioctl numbers. Nastier,
> yes. No question about it. But we don't necessarily have to redesign the
> whole approach - we only want to re-design the internal kernel interfaces.
>
> That, in turn, might be as simple as changing the ioctl incoming arguments
> of <cmd,arg> into a structure like <type,cmd,inbuf,inlen,outbuf,outlen>.

drivers/net/ppp_generic.c:
ppp_set_compress(struct ppp *ppp, unsigned long arg)
{
int err;
struct compressor *cp;
struct ppp_option_data data;
void *state;
unsigned char ccp_option[CCP_MAX_OPTION_LENGTH];
#ifdef CONFIG_KMOD
char modname[32];
#endif

err = -EFAULT;
if (copy_from_user(&data, (void *) arg, sizeof(data))
|| (data.length <= CCP_MAX_OPTION_LENGTH
&& copy_from_user(ccp_option, data.ptr, data.length)))
goto out;

And that's far from being uncommon. They _do_ follow pointers. Some - more
than once.

We _will_ have to support ioctls for long. No questions about that. And
there is no magic trick that would work for all of them, simply because
many are too disgusting to be left alive. Let's clean the groups that can
be cleaned and see what's left.