From b1a451321f3165c3beccf5e11aa7a438b535c409 Mon Sep 17 00:00:00 2001 From: mentor Date: Mon, 17 Mar 2008 04:46:00 +0000 Subject: [PATCH] The SIOCGATHDIAG ioctl tries to overlay a new struct defintion (struct ath_diag) onto the struct ifreq. Unfortunately, this structure appears to be too large on 64-bit platforms due to a larger pointer size; the technique may also suffer other problems. Remove the old SIOCGATHDIAG ioctl (return -EOPNOTSUPP), and add a new ioctl (SIOCGATHHALDIAG) that passes the struct through ifr_data. Also, return -EOPNOTSUPP for unknown IOCTL numbers. Incidently, I can't find anything that actually uses the old IOCTL. git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3389 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath/if_ath.c | 10 ++++++++-- ath/if_athioctl.h | 18 ++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ath/if_ath.c b/ath/if_ath.c index 604aff9..4127115 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -10348,6 +10348,7 @@ ath_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct ath_softc *sc = dev->priv; struct ieee80211com *ic = &sc->sc_ic; + struct ath_diag ad; int error; ATH_LOCK(sc); @@ -10363,10 +10364,15 @@ ath_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) error = 0; break; case SIOCGATHDIAG: + return -EOPNOTSUPP; + break; + case SIOCGATHHALDIAG: if (!capable(CAP_NET_ADMIN)) error = -EPERM; + else if (copy_from_user(&ad, ifr->ifr_data, sizeof(ad))) + error = -EFAULT; else - error = ath_ioctl_diag(sc, (struct ath_diag *)ifr); + error = ath_ioctl_diag(sc, &ad); break; case SIOCETHTOOL: if (copy_from_user(&cmd, ifr->ifr_data, sizeof(cmd))) @@ -10378,7 +10384,7 @@ ath_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) error = ieee80211_ioctl_create_vap(ic, ifr, dev); break; default: - error = -EINVAL; + error = -EOPNOTSUPP; break; } ATH_UNLOCK(sc); diff --git a/ath/if_athioctl.h b/ath/if_athioctl.h index 08e642f..54f12d0 100644 --- a/ath/if_athioctl.h +++ b/ath/if_athioctl.h @@ -101,27 +101,21 @@ struct ath_stats { }; struct ath_diag { - char ad_name[IFNAMSIZ]; /* if name, e.g. "ath0" */ - u_int16_t ad_id; + u_int16_t ad_id; #define ATH_DIAG_DYN 0x8000 /* allocate buffer in caller */ #define ATH_DIAG_IN 0x4000 /* copy in parameters */ #define ATH_DIAG_OUT 0x0000 /* copy out results (always) */ #define ATH_DIAG_ID 0x0fff - u_int16_t ad_in_size; /* pack to fit, yech */ - void __user *ad_in_data; - void __user *ad_out_data; - u_int ad_out_size; - + void __user *ad_in_data; + void __user *ad_out_data; + unsigned ad_in_size; + unsigned ad_out_size; }; #define ATH_RADAR_MUTE_TIME 1 /* Set dfs mute time for dfs test mode */ -#ifdef __linux__ #define SIOCGATHSTATS (SIOCDEVPRIVATE+0) #define SIOCGATHDIAG (SIOCDEVPRIVATE+1) #define SIOCGATHRADARSIG (SIOCDEVPRIVATE+2) -#else -#define SIOCGATHSTATS _IOWR('i', 137, struct ifreq) -#define SIOCGATHDIAG _IOWR('i', 138, struct ath_diag) -#endif +#define SIOCGATHHALDIAG (SIOCDEVPRIVATE+3) #endif /* _DEV_ATH_ATHIOCTL_H */ -- 2.35.1