···256256#define EIWCOMMIT EINPROGRESS257257258258/* Flags available in struct iw_request_info */259259-#define IW_REQUEST_FLAG_NONE 0x0000 /* No flag so far */259259+#define IW_REQUEST_FLAG_COMPAT 0x0001 /* Compat ioctl call */260260261261/* Type of headers we know about (basically union iwreq_data) */262262#define IW_HEADER_TYPE_NULL 0 /* Not available */
+33-40
net/wireless/wext.c
···834834static int ioctl_standard_call(struct net_device * dev,835835 struct iwreq *iwr,836836 unsigned int cmd,837837+ struct iw_request_info *info,837838 iw_handler handler)838839{839840 const struct iw_ioctl_description * descr;840840- struct iw_request_info info;841841 int ret = -EINVAL;842842843843 /* Get the description of the IOCTL */···845845 return -EOPNOTSUPP;846846 descr = &(standard_ioctl[cmd - SIOCIWFIRST]);847847848848- /* Prepare the call */849849- info.cmd = cmd;850850- info.flags = 0;851851-852848 /* Check if we have a pointer to user space data or not */853849 if (descr->header_type != IW_HEADER_TYPE_POINT) {854850855851 /* No extra arguments. Trivial to handle */856856- ret = handler(dev, &info, &(iwr->u), NULL);852852+ ret = handler(dev, info, &(iwr->u), NULL);857853858854 /* Generate an event to notify listeners of the change */859855 if ((descr->flags & IW_DESCR_FLAG_EVENT) &&···857861 wireless_send_event(dev, cmd, &(iwr->u), NULL);858862 } else {859863 ret = ioctl_standard_iw_point(&iwr->u.data, cmd, descr,860860- handler, dev, &info);864864+ handler, dev, info);861865 }862866863867 /* Call commit handler if needed and defined */···980984}981985982986static int ioctl_private_call(struct net_device *dev, struct iwreq *iwr,983983- unsigned int cmd, iw_handler handler)987987+ unsigned int cmd, struct iw_request_info *info,988988+ iw_handler handler)984989{985990 int extra_size = 0, ret = -EINVAL;986991 const struct iw_priv_args *descr;987987- struct iw_request_info info;988992989993 extra_size = get_priv_descr_and_size(dev, cmd, &descr);990990-991991- /* Prepare the call */992992- info.cmd = cmd;993993- info.flags = 0;994994995995 /* Check if we have a pointer to user space data or not. */996996 if (extra_size == 0) {997997 /* No extra arguments. Trivial to handle */998998- ret = handler(dev, &info, &(iwr->u), (char *) &(iwr->u));998998+ ret = handler(dev, info, &(iwr->u), (char *) &(iwr->u));999999 } else {10001000 ret = ioctl_private_iw_point(&iwr->u.data, cmd, descr,10011001- handler, dev, &info, extra_size);10011001+ handler, dev, info, extra_size);10021002 }1003100310041004 /* Call commit handler if needed and defined */···1006101410071015/* ---------------------------------------------------------------- */10081016typedef int (*wext_ioctl_func)(struct net_device *, struct iwreq *,10091009- unsigned int, iw_handler);10171017+ unsigned int, struct iw_request_info *,10181018+ iw_handler);1010101910111020/*10121021 * Main IOCTl dispatcher.···10151022 */10161023static int wireless_process_ioctl(struct net *net, struct ifreq *ifr,10171024 unsigned int cmd,10251025+ struct iw_request_info *info,10181026 wext_ioctl_func standard,10191027 wext_ioctl_func private)10201028{···10341040 * Note that 'cmd' is already filtered in dev_ioctl() with10351041 * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */10361042 if (cmd == SIOCGIWSTATS)10371037- return standard(dev, iwr, cmd,10431043+ return standard(dev, iwr, cmd, info,10381044 &iw_handler_get_iwstats);1039104510401046 if (cmd == SIOCGIWPRIV && dev->wireless_handlers)10411041- return standard(dev, iwr, cmd,10471047+ return standard(dev, iwr, cmd, info,10421048 &iw_handler_get_private);1043104910441050 /* Basic check */···10501056 if (handler) {10511057 /* Standard and private are not the same */10521058 if (cmd < SIOCIWFIRSTPRIV)10531053- return standard(dev, iwr, cmd, handler);10591059+ return standard(dev, iwr, cmd, info, handler);10541060 else10551055- return private(dev, iwr, cmd, handler);10611061+ return private(dev, iwr, cmd, info, handler);10561062 }10571063 /* Old driver API : call driver ioctl handler */10581064 if (dev->do_ioctl)···1074108010751081/* entry point from dev ioctl */10761082static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr,10771077- unsigned int cmd,10831083+ unsigned int cmd, struct iw_request_info *info,10781084 wext_ioctl_func standard,10791085 wext_ioctl_func private)10801086{···1085109110861092 dev_load(net, ifr->ifr_name);10871093 rtnl_lock();10881088- ret = wireless_process_ioctl(net, ifr, cmd, standard, private);10941094+ ret = wireless_process_ioctl(net, ifr, cmd, info, standard, private);10891095 rtnl_unlock();1090109610911097 return ret;···10941100int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,10951101 void __user *arg)10961102{10971097- int ret = wext_ioctl_dispatch(net, ifr, cmd,10981098- ioctl_standard_call,10991099- ioctl_private_call);11031103+ struct iw_request_info info = { .cmd = cmd, .flags = 0 };11041104+ int ret;1100110511061106+ ret = wext_ioctl_dispatch(net, ifr, cmd, &info,11071107+ ioctl_standard_call,11081108+ ioctl_private_call);11011109 if (ret >= 0 &&11021110 IW_IS_GET(cmd) &&11031111 copy_to_user(arg, ifr, sizeof(struct iwreq)))···11121116static int compat_standard_call(struct net_device *dev,11131117 struct iwreq *iwr,11141118 unsigned int cmd,11191119+ struct iw_request_info *info,11151120 iw_handler handler)11161121{11171122 const struct iw_ioctl_description *descr;11181123 struct compat_iw_point *iwp_compat;11191119- struct iw_request_info info;11201124 struct iw_point iwp;11211125 int err;1122112611231127 descr = standard_ioctl + (cmd - SIOCIWFIRST);1124112811251129 if (descr->header_type != IW_HEADER_TYPE_POINT)11261126- return ioctl_standard_call(dev, iwr, cmd, handler);11301130+ return ioctl_standard_call(dev, iwr, cmd, info, handler);1127113111281132 iwp_compat = (struct compat_iw_point *) &iwr->u.data;11291133 iwp.pointer = compat_ptr(iwp_compat->pointer);11301134 iwp.length = iwp_compat->length;11311135 iwp.flags = iwp_compat->flags;1132113611331133- info.cmd = cmd;11341134- info.flags = 0;11351135-11361136- err = ioctl_standard_iw_point(&iwp, cmd, descr, handler, dev, &info);11371137+ err = ioctl_standard_iw_point(&iwp, cmd, descr, handler, dev, info);1137113811381139 iwp_compat->pointer = ptr_to_compat(iwp.pointer);11391140 iwp_compat->length = iwp.length;···11401147}1141114811421149static int compat_private_call(struct net_device *dev, struct iwreq *iwr,11431143- unsigned int cmd, iw_handler handler)11501150+ unsigned int cmd, struct iw_request_info *info,11511151+ iw_handler handler)11441152{11451153 const struct iw_priv_args *descr;11461146- struct iw_request_info info;11471154 int ret, extra_size;1148115511491156 extra_size = get_priv_descr_and_size(dev, cmd, &descr);1150115711511151- /* Prepare the call */11521152- info.cmd = cmd;11531153- info.flags = 0;11541154-11551158 /* Check if we have a pointer to user space data or not. */11561159 if (extra_size == 0) {11571160 /* No extra arguments. Trivial to handle */11581158- ret = handler(dev, &info, &(iwr->u), (char *) &(iwr->u));11611161+ ret = handler(dev, info, &(iwr->u), (char *) &(iwr->u));11591162 } else {11601163 struct compat_iw_point *iwp_compat;11611164 struct iw_point iwp;···11621173 iwp.flags = iwp_compat->flags;1163117411641175 ret = ioctl_private_iw_point(&iwp, cmd, descr,11651165- handler, dev, &info, extra_size);11761176+ handler, dev, info, extra_size);1166117711671178 iwp_compat->pointer = ptr_to_compat(iwp.pointer);11681179 iwp_compat->length = iwp.length;···11801191 unsigned long arg)11811192{11821193 void __user *argp = (void __user *)arg;11941194+ struct iw_request_info info;11831195 struct iwreq iwr;11841196 char *colon;11851197 int ret;···11931203 if (colon)11941204 *colon = 0;1195120511961196- ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd,12061206+ info.cmd = cmd;12071207+ info.flags = IW_REQUEST_FLAG_COMPAT;12081208+12091209+ ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd, &info,11971210 compat_standard_call,11981211 compat_private_call);11991212