linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Prasun Maiti <prasunmaiti87@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Dibyajyoti Ghosh <dibyajyotig@gmail.com>,
	Ujjal Roy <royujjal@gmail.com>,
	WiFi Mailing List <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel
Date: Fri, 03 Jun 2016 20:47:00 +0200	[thread overview]
Message-ID: <1464979620.2224.5.camel@sipsolutions.net> (raw)
In-Reply-To: <CAEO8o4=-oYuHuh42yfRa6kAUZ2hBmxHabU-W3V82kURg-GZv_g@mail.gmail.com> (sfid-20160603_112414_628143_FA6C3B59)



>      diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
> index 6250b1c..50583fb 100644
> --- a/net/wireless/wext-core.c
> +++ b/net/wireless/wext-core.c
> @@ -958,8 +958,28 @@ static int wireless_process_ioctl(struct net
> *net, struct ifreq *ifr,
>             return private(dev, iwr, cmd, info, handler);
>     }
>     /* Old driver API : call driver ioctl handler */
> -   if (dev->netdev_ops->ndo_do_ioctl)
> -       return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
> +   if (dev->netdev_ops->ndo_do_ioctl) {
> +       if (info->flags & IW_REQUEST_FLAG_COMPAT) {
> +           int ret = 0;
> +           struct iwreq iwrp;
> +           struct compat_iw_point *iwp_compat =
> +               (struct compat_iw_point *) &iwr->u.data;

No need for the long cast - use (void *).

> +           strncpy(iwrp.ifr_ifrn.ifrn_name, iwr->ifr_ifrn.ifrn_name, 
> IFNAMSIZ);
> +           iwrp.u.data.pointer = compat_ptr(iwp_compat->pointer);
> +           iwrp.u.data.length = iwp_compat->length;
> +           iwrp.u.data.flags = iwp_compat->flags;

Maybe you should clear iwrp first?

> +           ret = dev->netdev_ops->ndo_do_ioctl(dev, (struct ifreq *)
> &iwrp, cmd);

Same here with the cast.

I'd blissfully forgotten how totally crufty this API is ... oh well.

> +           iwp_compat->pointer = ptr_to_compat(iwrp.u.data.pointer);
> +           iwp_compat->length = iwrp.u.data.length;
> +           iwp_compat->flags = iwrp.u.data.flags;
> +           return ret;
> +       } else {
> +           return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);





Please resend as a proper patch, with signed-off-by etc., and a commit
log explaining the problem and solution.

Thanks,
johannes

  reply	other threads:[~2016-06-03 18:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26  7:40 [PATCH] wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel Prasun Maiti
2016-05-31 10:25 ` Johannes Berg
2016-06-03  9:24   ` Prasun Maiti
2016-06-03 18:47     ` Johannes Berg [this message]
2016-06-04  4:50       ` wext: making deprecation more visible Kalle Valo
2016-06-07  7:13         ` Johannes Berg
2016-06-06 14:34   ` [PATCH] wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel Prasun Maiti
2016-06-09  7:57     ` Johannes Berg

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=1464979620.2224.5.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=davem@davemloft.net \
    --cc=dibyajyotig@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=prasunmaiti87@gmail.com \
    --cc=royujjal@gmail.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).