Re: [PATCH 4/4] ipv4,appletalk: move SIOCADDRT and SIOCDELRT handling into ->compat_ioctl

From: David Miller
Date: Thu May 14 2020 - 20:52:30 EST


From: Christoph Hellwig <hch@xxxxxx>
Date: Thu, 14 May 2020 16:45:35 +0200

> #ifdef CONFIG_COMPAT
> +static int atalk_compat_routing_ioctl(struct sock *sk, unsigned int cmd,
> + struct compat_rtentry __user *ur)
> +{
> + struct rtentry rt;
> + compat_uptr_t rtdev;
> +

Reverse christmas tree please.

> static int atalk_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
> {
> + struct sock *sk = sock->sk;
> + void __user *argp = compat_ptr(arg);

Likewise.

> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index 6177c4ba00370..b99c5e36e0a8f 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -968,17 +969,42 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
> EXPORT_SYMBOL(inet_ioctl);
>
> #ifdef CONFIG_COMPAT
> +static int inet_compat_routing_ioctl(struct sock *sk, unsigned int cmd,
> + struct compat_rtentry __user *ur)
> +{
> + struct rtentry rt;
> + compat_uptr_t rtdev;

Likewise.