idx
int64
func_before
string
Vulnerability Classification
string
vul
int64
func_after
string
patch
string
CWE ID
string
lines_before
string
lines_after
string
19,100
static void veth_get_strings(struct net_device *dev, u32 stringset, u8 *buf) { switch(stringset) { case ETH_SS_STATS: memcpy(buf, &ethtool_stats_keys, sizeof(ethtool_stats_keys)); break; } }
DoS
0
static void veth_get_strings(struct net_device *dev, u32 stringset, u8 *buf) { switch(stringset) { case ETH_SS_STATS: memcpy(buf, &ethtool_stats_keys, sizeof(ethtool_stats_keys)); break; } }
@@ -263,6 +263,8 @@ static void veth_setup(struct net_device *dev) { ether_setup(dev); + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->netdev_ops = &veth_netdev_ops; dev->ethtool_ops = &veth_ethtool_ops; dev->features |= NETIF_F_LLTX;
CWE-264
null
null
19,101
static __init int veth_init(void) { return rtnl_link_register(&veth_link_ops); }
DoS
0
static __init int veth_init(void) { return rtnl_link_register(&veth_link_ops); }
@@ -263,6 +263,8 @@ static void veth_setup(struct net_device *dev) { ether_setup(dev); + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->netdev_ops = &veth_netdev_ops; dev->ethtool_ops = &veth_ethtool_ops; dev->features |= NETIF_F_LLTX;
CWE-264
null
null
19,102
static int veth_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { int err; struct net_device *peer; struct veth_priv *priv; char ifname[IFNAMSIZ]; struct nlattr *peer_tb[IFLA_MAX + 1], **tbp; struct ifinfomsg *ifmp; struct net *net; /* * create and register peer first */ if (data != NULL && data[VETH_INFO_PEER] != NULL) { struct nlattr *nla_peer; nla_peer = data[VETH_INFO_PEER]; ifmp = nla_data(nla_peer); err = nla_parse(peer_tb, IFLA_MAX, nla_data(nla_peer) + sizeof(struct ifinfomsg), nla_len(nla_peer) - sizeof(struct ifinfomsg), ifla_policy); if (err < 0) return err; err = veth_validate(peer_tb, NULL); if (err < 0) return err; tbp = peer_tb; } else { ifmp = NULL; tbp = tb; } if (tbp[IFLA_IFNAME]) nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ); else snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d"); net = rtnl_link_get_net(src_net, tbp); if (IS_ERR(net)) return PTR_ERR(net); peer = rtnl_create_link(src_net, net, ifname, &veth_link_ops, tbp); if (IS_ERR(peer)) { put_net(net); return PTR_ERR(peer); } if (tbp[IFLA_ADDRESS] == NULL) random_ether_addr(peer->dev_addr); err = register_netdevice(peer); put_net(net); net = NULL; if (err < 0) goto err_register_peer; netif_carrier_off(peer); err = rtnl_configure_link(peer, ifmp); if (err < 0) goto err_configure_peer; /* * register dev last * * note, that since we've registered new device the dev's name * should be re-allocated */ if (tb[IFLA_ADDRESS] == NULL) random_ether_addr(dev->dev_addr); if (tb[IFLA_IFNAME]) nla_strlcpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ); else snprintf(dev->name, IFNAMSIZ, DRV_NAME "%%d"); if (strchr(dev->name, '%')) { err = dev_alloc_name(dev, dev->name); if (err < 0) goto err_alloc_name; } err = register_netdevice(dev); if (err < 0) goto err_register_dev; netif_carrier_off(dev); /* * tie the deviced together */ priv = netdev_priv(dev); priv->peer = peer; priv = netdev_priv(peer); priv->peer = dev; return 0; err_register_dev: /* nothing to do */ err_alloc_name: err_configure_peer: unregister_netdevice(peer); return err; err_register_peer: free_netdev(peer); return err; }
DoS
0
static int veth_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { int err; struct net_device *peer; struct veth_priv *priv; char ifname[IFNAMSIZ]; struct nlattr *peer_tb[IFLA_MAX + 1], **tbp; struct ifinfomsg *ifmp; struct net *net; /* * create and register peer first */ if (data != NULL && data[VETH_INFO_PEER] != NULL) { struct nlattr *nla_peer; nla_peer = data[VETH_INFO_PEER]; ifmp = nla_data(nla_peer); err = nla_parse(peer_tb, IFLA_MAX, nla_data(nla_peer) + sizeof(struct ifinfomsg), nla_len(nla_peer) - sizeof(struct ifinfomsg), ifla_policy); if (err < 0) return err; err = veth_validate(peer_tb, NULL); if (err < 0) return err; tbp = peer_tb; } else { ifmp = NULL; tbp = tb; } if (tbp[IFLA_IFNAME]) nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ); else snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d"); net = rtnl_link_get_net(src_net, tbp); if (IS_ERR(net)) return PTR_ERR(net); peer = rtnl_create_link(src_net, net, ifname, &veth_link_ops, tbp); if (IS_ERR(peer)) { put_net(net); return PTR_ERR(peer); } if (tbp[IFLA_ADDRESS] == NULL) random_ether_addr(peer->dev_addr); err = register_netdevice(peer); put_net(net); net = NULL; if (err < 0) goto err_register_peer; netif_carrier_off(peer); err = rtnl_configure_link(peer, ifmp); if (err < 0) goto err_configure_peer; /* * register dev last * * note, that since we've registered new device the dev's name * should be re-allocated */ if (tb[IFLA_ADDRESS] == NULL) random_ether_addr(dev->dev_addr); if (tb[IFLA_IFNAME]) nla_strlcpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ); else snprintf(dev->name, IFNAMSIZ, DRV_NAME "%%d"); if (strchr(dev->name, '%')) { err = dev_alloc_name(dev, dev->name); if (err < 0) goto err_alloc_name; } err = register_netdevice(dev); if (err < 0) goto err_register_dev; netif_carrier_off(dev); /* * tie the deviced together */ priv = netdev_priv(dev); priv->peer = peer; priv = netdev_priv(peer); priv->peer = dev; return 0; err_register_dev: /* nothing to do */ err_alloc_name: err_configure_peer: unregister_netdevice(peer); return err; err_register_peer: free_netdev(peer); return err; }
@@ -263,6 +263,8 @@ static void veth_setup(struct net_device *dev) { ether_setup(dev); + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->netdev_ops = &veth_netdev_ops; dev->ethtool_ops = &veth_ethtool_ops; dev->features |= NETIF_F_LLTX;
CWE-264
null
null
19,103
static int veth_open(struct net_device *dev) { struct veth_priv *priv; priv = netdev_priv(dev); if (priv->peer == NULL) return -ENOTCONN; if (priv->peer->flags & IFF_UP) { netif_carrier_on(dev); netif_carrier_on(priv->peer); } return 0; }
DoS
0
static int veth_open(struct net_device *dev) { struct veth_priv *priv; priv = netdev_priv(dev); if (priv->peer == NULL) return -ENOTCONN; if (priv->peer->flags & IFF_UP) { netif_carrier_on(dev); netif_carrier_on(priv->peer); } return 0; }
@@ -263,6 +263,8 @@ static void veth_setup(struct net_device *dev) { ether_setup(dev); + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->netdev_ops = &veth_netdev_ops; dev->ethtool_ops = &veth_ethtool_ops; dev->features |= NETIF_F_LLTX;
CWE-264
null
null
19,104
static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) { struct net_device *rcv = NULL; struct veth_priv *priv, *rcv_priv; struct veth_net_stats *stats, *rcv_stats; int length; priv = netdev_priv(dev); rcv = priv->peer; rcv_priv = netdev_priv(rcv); stats = this_cpu_ptr(priv->stats); rcv_stats = this_cpu_ptr(rcv_priv->stats); /* don't change ip_summed == CHECKSUM_PARTIAL, as that will cause bad checksum on forwarded packets */ if (skb->ip_summed == CHECKSUM_NONE && rcv->features & NETIF_F_RXCSUM) skb->ip_summed = CHECKSUM_UNNECESSARY; length = skb->len; if (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS) goto rx_drop; u64_stats_update_begin(&stats->syncp); stats->tx_bytes += length; stats->tx_packets++; u64_stats_update_end(&stats->syncp); u64_stats_update_begin(&rcv_stats->syncp); rcv_stats->rx_bytes += length; rcv_stats->rx_packets++; u64_stats_update_end(&rcv_stats->syncp); return NETDEV_TX_OK; rx_drop: u64_stats_update_begin(&rcv_stats->syncp); rcv_stats->rx_dropped++; u64_stats_update_end(&rcv_stats->syncp); return NETDEV_TX_OK; }
DoS
0
static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) { struct net_device *rcv = NULL; struct veth_priv *priv, *rcv_priv; struct veth_net_stats *stats, *rcv_stats; int length; priv = netdev_priv(dev); rcv = priv->peer; rcv_priv = netdev_priv(rcv); stats = this_cpu_ptr(priv->stats); rcv_stats = this_cpu_ptr(rcv_priv->stats); /* don't change ip_summed == CHECKSUM_PARTIAL, as that will cause bad checksum on forwarded packets */ if (skb->ip_summed == CHECKSUM_NONE && rcv->features & NETIF_F_RXCSUM) skb->ip_summed = CHECKSUM_UNNECESSARY; length = skb->len; if (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS) goto rx_drop; u64_stats_update_begin(&stats->syncp); stats->tx_bytes += length; stats->tx_packets++; u64_stats_update_end(&stats->syncp); u64_stats_update_begin(&rcv_stats->syncp); rcv_stats->rx_bytes += length; rcv_stats->rx_packets++; u64_stats_update_end(&rcv_stats->syncp); return NETDEV_TX_OK; rx_drop: u64_stats_update_begin(&rcv_stats->syncp); rcv_stats->rx_dropped++; u64_stats_update_end(&rcv_stats->syncp); return NETDEV_TX_OK; }
@@ -263,6 +263,8 @@ static void veth_setup(struct net_device *dev) { ether_setup(dev); + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->netdev_ops = &veth_netdev_ops; dev->ethtool_ops = &veth_ethtool_ops; dev->features |= NETIF_F_LLTX;
CWE-264
null
null
19,105
static pvc_device* add_pvc(struct net_device *dev, u16 dlci) { hdlc_device *hdlc = dev_to_hdlc(dev); pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc; while (*pvc_p) { if ((*pvc_p)->dlci == dlci) return *pvc_p; if ((*pvc_p)->dlci > dlci) break; /* the list is sorted */ pvc_p = &(*pvc_p)->next; } pvc = kzalloc(sizeof(pvc_device), GFP_ATOMIC); #ifdef DEBUG_PVC printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); #endif if (!pvc) return NULL; pvc->dlci = dlci; pvc->frad = dev; pvc->next = *pvc_p; /* Put it in the chain */ *pvc_p = pvc; return pvc; }
DoS
0
static pvc_device* add_pvc(struct net_device *dev, u16 dlci) { hdlc_device *hdlc = dev_to_hdlc(dev); pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc; while (*pvc_p) { if ((*pvc_p)->dlci == dlci) return *pvc_p; if ((*pvc_p)->dlci > dlci) break; /* the list is sorted */ pvc_p = &(*pvc_p)->next; } pvc = kzalloc(sizeof(pvc_device), GFP_ATOMIC); #ifdef DEBUG_PVC printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); #endif if (!pvc) return NULL; pvc->dlci = dlci; pvc->frad = dev; pvc->next = *pvc_p; /* Put it in the chain */ *pvc_p = pvc; return pvc; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,106
static inline void delete_unused_pvcs(hdlc_device *hdlc) { pvc_device **pvc_p = &state(hdlc)->first_pvc; while (*pvc_p) { if (!pvc_is_used(*pvc_p)) { pvc_device *pvc = *pvc_p; #ifdef DEBUG_PVC printk(KERN_DEBUG "freeing unused pvc: %p\n", pvc); #endif *pvc_p = pvc->next; kfree(pvc); continue; } pvc_p = &(*pvc_p)->next; } }
DoS
0
static inline void delete_unused_pvcs(hdlc_device *hdlc) { pvc_device **pvc_p = &state(hdlc)->first_pvc; while (*pvc_p) { if (!pvc_is_used(*pvc_p)) { pvc_device *pvc = *pvc_p; #ifdef DEBUG_PVC printk(KERN_DEBUG "freeing unused pvc: %p\n", pvc); #endif *pvc_p = pvc->next; kfree(pvc); continue; } pvc_p = &(*pvc_p)->next; } }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,107
static inline void dlci_to_q922(u8 *hdr, u16 dlci) { hdr[0] = (dlci >> 2) & 0xFC; hdr[1] = ((dlci << 4) & 0xF0) | 0x01; }
DoS
0
static inline void dlci_to_q922(u8 *hdr, u16 dlci) { hdr[0] = (dlci >> 2) & 0xFC; hdr[1] = ((dlci << 4) & 0xF0) | 0x01; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,108
static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci) { pvc_device *pvc = state(hdlc)->first_pvc; while (pvc) { if (pvc->dlci == dlci) return pvc; if (pvc->dlci > dlci) return NULL; /* the list is sorted */ pvc = pvc->next; } return NULL; }
DoS
0
static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci) { pvc_device *pvc = state(hdlc)->first_pvc; while (pvc) { if (pvc->dlci == dlci) return pvc; if (pvc->dlci > dlci) return NULL; /* the list is sorted */ pvc = pvc->next; } return NULL; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,109
static void fr_close(struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); pvc_device *pvc = state(hdlc)->first_pvc; while (pvc) { /* Shutdown all PVCs for this FRAD */ if (pvc->main) dev_close(pvc->main); if (pvc->ether) dev_close(pvc->ether); pvc = pvc->next; } }
DoS
0
static void fr_close(struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); pvc_device *pvc = state(hdlc)->first_pvc; while (pvc) { /* Shutdown all PVCs for this FRAD */ if (pvc->main) dev_close(pvc->main); if (pvc->ether) dev_close(pvc->ether); pvc = pvc->next; } }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,110
static void fr_destroy(struct net_device *frad) { hdlc_device *hdlc = dev_to_hdlc(frad); pvc_device *pvc = state(hdlc)->first_pvc; state(hdlc)->first_pvc = NULL; /* All PVCs destroyed */ state(hdlc)->dce_pvc_count = 0; state(hdlc)->dce_changed = 1; while (pvc) { pvc_device *next = pvc->next; /* destructors will free_netdev() main and ether */ if (pvc->main) unregister_netdevice(pvc->main); if (pvc->ether) unregister_netdevice(pvc->ether); kfree(pvc); pvc = next; } }
DoS
0
static void fr_destroy(struct net_device *frad) { hdlc_device *hdlc = dev_to_hdlc(frad); pvc_device *pvc = state(hdlc)->first_pvc; state(hdlc)->first_pvc = NULL; /* All PVCs destroyed */ state(hdlc)->dce_pvc_count = 0; state(hdlc)->dce_changed = 1; while (pvc) { pvc_device *next = pvc->next; /* destructors will free_netdev() main and ether */ if (pvc->main) unregister_netdevice(pvc->main); if (pvc->ether) unregister_netdevice(pvc->ether); kfree(pvc); pvc = next; } }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,111
static int fr_hard_header(struct sk_buff **skb_p, u16 dlci) { u16 head_len; struct sk_buff *skb = *skb_p; switch (skb->protocol) { case cpu_to_be16(NLPID_CCITT_ANSI_LMI): head_len = 4; skb_push(skb, head_len); skb->data[3] = NLPID_CCITT_ANSI_LMI; break; case cpu_to_be16(NLPID_CISCO_LMI): head_len = 4; skb_push(skb, head_len); skb->data[3] = NLPID_CISCO_LMI; break; case cpu_to_be16(ETH_P_IP): head_len = 4; skb_push(skb, head_len); skb->data[3] = NLPID_IP; break; case cpu_to_be16(ETH_P_IPV6): head_len = 4; skb_push(skb, head_len); skb->data[3] = NLPID_IPV6; break; case cpu_to_be16(ETH_P_802_3): head_len = 10; if (skb_headroom(skb) < head_len) { struct sk_buff *skb2 = skb_realloc_headroom(skb, head_len); if (!skb2) return -ENOBUFS; dev_kfree_skb(skb); skb = *skb_p = skb2; } skb_push(skb, head_len); skb->data[3] = FR_PAD; skb->data[4] = NLPID_SNAP; skb->data[5] = FR_PAD; skb->data[6] = 0x80; skb->data[7] = 0xC2; skb->data[8] = 0x00; skb->data[9] = 0x07; /* bridged Ethernet frame w/out FCS */ break; default: head_len = 10; skb_push(skb, head_len); skb->data[3] = FR_PAD; skb->data[4] = NLPID_SNAP; skb->data[5] = FR_PAD; skb->data[6] = FR_PAD; skb->data[7] = FR_PAD; *(__be16*)(skb->data + 8) = skb->protocol; } dlci_to_q922(skb->data, dlci); skb->data[2] = FR_UI; return 0; }
DoS
0
static int fr_hard_header(struct sk_buff **skb_p, u16 dlci) { u16 head_len; struct sk_buff *skb = *skb_p; switch (skb->protocol) { case cpu_to_be16(NLPID_CCITT_ANSI_LMI): head_len = 4; skb_push(skb, head_len); skb->data[3] = NLPID_CCITT_ANSI_LMI; break; case cpu_to_be16(NLPID_CISCO_LMI): head_len = 4; skb_push(skb, head_len); skb->data[3] = NLPID_CISCO_LMI; break; case cpu_to_be16(ETH_P_IP): head_len = 4; skb_push(skb, head_len); skb->data[3] = NLPID_IP; break; case cpu_to_be16(ETH_P_IPV6): head_len = 4; skb_push(skb, head_len); skb->data[3] = NLPID_IPV6; break; case cpu_to_be16(ETH_P_802_3): head_len = 10; if (skb_headroom(skb) < head_len) { struct sk_buff *skb2 = skb_realloc_headroom(skb, head_len); if (!skb2) return -ENOBUFS; dev_kfree_skb(skb); skb = *skb_p = skb2; } skb_push(skb, head_len); skb->data[3] = FR_PAD; skb->data[4] = NLPID_SNAP; skb->data[5] = FR_PAD; skb->data[6] = 0x80; skb->data[7] = 0xC2; skb->data[8] = 0x00; skb->data[9] = 0x07; /* bridged Ethernet frame w/out FCS */ break; default: head_len = 10; skb_push(skb, head_len); skb->data[3] = FR_PAD; skb->data[4] = NLPID_SNAP; skb->data[5] = FR_PAD; skb->data[6] = FR_PAD; skb->data[7] = FR_PAD; *(__be16*)(skb->data + 8) = skb->protocol; } dlci_to_q922(skb->data, dlci); skb->data[2] = FR_UI; return 0; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,112
static int fr_ioctl(struct net_device *dev, struct ifreq *ifr) { fr_proto __user *fr_s = ifr->ifr_settings.ifs_ifsu.fr; const size_t size = sizeof(fr_proto); fr_proto new_settings; hdlc_device *hdlc = dev_to_hdlc(dev); fr_proto_pvc pvc; int result; switch (ifr->ifr_settings.type) { case IF_GET_PROTO: if (dev_to_hdlc(dev)->proto != &proto) /* Different proto */ return -EINVAL; ifr->ifr_settings.type = IF_PROTO_FR; if (ifr->ifr_settings.size < size) { ifr->ifr_settings.size = size; /* data size wanted */ return -ENOBUFS; } if (copy_to_user(fr_s, &state(hdlc)->settings, size)) return -EFAULT; return 0; case IF_PROTO_FR: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (dev->flags & IFF_UP) return -EBUSY; if (copy_from_user(&new_settings, fr_s, size)) return -EFAULT; if (new_settings.lmi == LMI_DEFAULT) new_settings.lmi = LMI_ANSI; if ((new_settings.lmi != LMI_NONE && new_settings.lmi != LMI_ANSI && new_settings.lmi != LMI_CCITT && new_settings.lmi != LMI_CISCO) || new_settings.t391 < 1 || new_settings.t392 < 2 || new_settings.n391 < 1 || new_settings.n392 < 1 || new_settings.n393 < new_settings.n392 || new_settings.n393 > 32 || (new_settings.dce != 0 && new_settings.dce != 1)) return -EINVAL; result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); if (result) return result; if (dev_to_hdlc(dev)->proto != &proto) { /* Different proto */ result = attach_hdlc_protocol(dev, &proto, sizeof(struct frad_state)); if (result) return result; state(hdlc)->first_pvc = NULL; state(hdlc)->dce_pvc_count = 0; } memcpy(&state(hdlc)->settings, &new_settings, size); dev->type = ARPHRD_FRAD; return 0; case IF_PROTO_FR_ADD_PVC: case IF_PROTO_FR_DEL_PVC: case IF_PROTO_FR_ADD_ETH_PVC: case IF_PROTO_FR_DEL_ETH_PVC: if (dev_to_hdlc(dev)->proto != &proto) /* Different proto */ return -EINVAL; if (!capable(CAP_NET_ADMIN)) return -EPERM; if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc, sizeof(fr_proto_pvc))) return -EFAULT; if (pvc.dlci <= 0 || pvc.dlci >= 1024) return -EINVAL; /* Only 10 bits, DLCI 0 reserved */ if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC || ifr->ifr_settings.type == IF_PROTO_FR_DEL_ETH_PVC) result = ARPHRD_ETHER; /* bridged Ethernet device */ else result = ARPHRD_DLCI; if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_PVC || ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC) return fr_add_pvc(dev, pvc.dlci, result); else return fr_del_pvc(hdlc, pvc.dlci, result); } return -EINVAL; }
DoS
0
static int fr_ioctl(struct net_device *dev, struct ifreq *ifr) { fr_proto __user *fr_s = ifr->ifr_settings.ifs_ifsu.fr; const size_t size = sizeof(fr_proto); fr_proto new_settings; hdlc_device *hdlc = dev_to_hdlc(dev); fr_proto_pvc pvc; int result; switch (ifr->ifr_settings.type) { case IF_GET_PROTO: if (dev_to_hdlc(dev)->proto != &proto) /* Different proto */ return -EINVAL; ifr->ifr_settings.type = IF_PROTO_FR; if (ifr->ifr_settings.size < size) { ifr->ifr_settings.size = size; /* data size wanted */ return -ENOBUFS; } if (copy_to_user(fr_s, &state(hdlc)->settings, size)) return -EFAULT; return 0; case IF_PROTO_FR: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (dev->flags & IFF_UP) return -EBUSY; if (copy_from_user(&new_settings, fr_s, size)) return -EFAULT; if (new_settings.lmi == LMI_DEFAULT) new_settings.lmi = LMI_ANSI; if ((new_settings.lmi != LMI_NONE && new_settings.lmi != LMI_ANSI && new_settings.lmi != LMI_CCITT && new_settings.lmi != LMI_CISCO) || new_settings.t391 < 1 || new_settings.t392 < 2 || new_settings.n391 < 1 || new_settings.n392 < 1 || new_settings.n393 < new_settings.n392 || new_settings.n393 > 32 || (new_settings.dce != 0 && new_settings.dce != 1)) return -EINVAL; result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); if (result) return result; if (dev_to_hdlc(dev)->proto != &proto) { /* Different proto */ result = attach_hdlc_protocol(dev, &proto, sizeof(struct frad_state)); if (result) return result; state(hdlc)->first_pvc = NULL; state(hdlc)->dce_pvc_count = 0; } memcpy(&state(hdlc)->settings, &new_settings, size); dev->type = ARPHRD_FRAD; return 0; case IF_PROTO_FR_ADD_PVC: case IF_PROTO_FR_DEL_PVC: case IF_PROTO_FR_ADD_ETH_PVC: case IF_PROTO_FR_DEL_ETH_PVC: if (dev_to_hdlc(dev)->proto != &proto) /* Different proto */ return -EINVAL; if (!capable(CAP_NET_ADMIN)) return -EPERM; if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc, sizeof(fr_proto_pvc))) return -EFAULT; if (pvc.dlci <= 0 || pvc.dlci >= 1024) return -EINVAL; /* Only 10 bits, DLCI 0 reserved */ if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC || ifr->ifr_settings.type == IF_PROTO_FR_DEL_ETH_PVC) result = ARPHRD_ETHER; /* bridged Ethernet device */ else result = ARPHRD_DLCI; if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_PVC || ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC) return fr_add_pvc(dev, pvc.dlci, result); else return fr_del_pvc(hdlc, pvc.dlci, result); } return -EINVAL; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,113
static inline u8 fr_lmi_nextseq(u8 x) { x++; return x ? x : 1; }
DoS
0
static inline u8 fr_lmi_nextseq(u8 x) { x++; return x ? x : 1; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,114
static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb) { hdlc_device *hdlc = dev_to_hdlc(dev); pvc_device *pvc; u8 rxseq, txseq; int lmi = state(hdlc)->settings.lmi; int dce = state(hdlc)->settings.dce; int stat_len = (lmi == LMI_CISCO) ? 6 : 3, reptype, error, no_ram, i; if (skb->len < (lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH)) { netdev_info(dev, "Short LMI frame\n"); return 1; } if (skb->data[3] != (lmi == LMI_CISCO ? NLPID_CISCO_LMI : NLPID_CCITT_ANSI_LMI)) { netdev_info(dev, "Received non-LMI frame with LMI DLCI\n"); return 1; } if (skb->data[4] != LMI_CALLREF) { netdev_info(dev, "Invalid LMI Call reference (0x%02X)\n", skb->data[4]); return 1; } if (skb->data[5] != (dce ? LMI_STATUS_ENQUIRY : LMI_STATUS)) { netdev_info(dev, "Invalid LMI Message type (0x%02X)\n", skb->data[5]); return 1; } if (lmi == LMI_ANSI) { if (skb->data[6] != LMI_ANSI_LOCKSHIFT) { netdev_info(dev, "Not ANSI locking shift in LMI message (0x%02X)\n", skb->data[6]); return 1; } i = 7; } else i = 6; if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_REPTYPE : LMI_ANSI_CISCO_REPTYPE)) { netdev_info(dev, "Not an LMI Report type IE (0x%02X)\n", skb->data[i]); return 1; } if (skb->data[++i] != LMI_REPT_LEN) { netdev_info(dev, "Invalid LMI Report type IE length (%u)\n", skb->data[i]); return 1; } reptype = skb->data[++i]; if (reptype != LMI_INTEGRITY && reptype != LMI_FULLREP) { netdev_info(dev, "Unsupported LMI Report type (0x%02X)\n", reptype); return 1; } if (skb->data[++i] != (lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE)) { netdev_info(dev, "Not an LMI Link integrity verification IE (0x%02X)\n", skb->data[i]); return 1; } if (skb->data[++i] != LMI_INTEG_LEN) { netdev_info(dev, "Invalid LMI Link integrity verification IE length (%u)\n", skb->data[i]); return 1; } i++; state(hdlc)->rxseq = skb->data[i++]; /* TX sequence from peer */ rxseq = skb->data[i++]; /* Should confirm our sequence */ txseq = state(hdlc)->txseq; if (dce) state(hdlc)->last_poll = jiffies; error = 0; if (!state(hdlc)->reliable) error = 1; if (rxseq == 0 || rxseq != txseq) { /* Ask for full report next time */ state(hdlc)->n391cnt = 0; error = 1; } if (dce) { if (state(hdlc)->fullrep_sent && !error) { /* Stop sending full report - the last one has been confirmed by DTE */ state(hdlc)->fullrep_sent = 0; pvc = state(hdlc)->first_pvc; while (pvc) { if (pvc->state.new) { pvc->state.new = 0; /* Tell DTE that new PVC is now active */ state(hdlc)->dce_changed = 1; } pvc = pvc->next; } } if (state(hdlc)->dce_changed) { reptype = LMI_FULLREP; state(hdlc)->fullrep_sent = 1; state(hdlc)->dce_changed = 0; } state(hdlc)->request = 1; /* got request */ fr_lmi_send(dev, reptype == LMI_FULLREP ? 1 : 0); return 0; } /* DTE */ state(hdlc)->request = 0; /* got response, no request pending */ if (error) return 0; if (reptype != LMI_FULLREP) return 0; pvc = state(hdlc)->first_pvc; while (pvc) { pvc->state.deleted = 1; pvc = pvc->next; } no_ram = 0; while (skb->len >= i + 2 + stat_len) { u16 dlci; u32 bw; unsigned int active, new; if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT : LMI_ANSI_CISCO_PVCSTAT)) { netdev_info(dev, "Not an LMI PVC status IE (0x%02X)\n", skb->data[i]); return 1; } if (skb->data[++i] != stat_len) { netdev_info(dev, "Invalid LMI PVC status IE length (%u)\n", skb->data[i]); return 1; } i++; new = !! (skb->data[i + 2] & 0x08); active = !! (skb->data[i + 2] & 0x02); if (lmi == LMI_CISCO) { dlci = (skb->data[i] << 8) | skb->data[i + 1]; bw = (skb->data[i + 3] << 16) | (skb->data[i + 4] << 8) | (skb->data[i + 5]); } else { dlci = ((skb->data[i] & 0x3F) << 4) | ((skb->data[i + 1] & 0x78) >> 3); bw = 0; } pvc = add_pvc(dev, dlci); if (!pvc && !no_ram) { netdev_warn(dev, "Memory squeeze on fr_lmi_recv()\n"); no_ram = 1; } if (pvc) { pvc->state.exist = 1; pvc->state.deleted = 0; if (active != pvc->state.active || new != pvc->state.new || bw != pvc->state.bandwidth || !pvc->state.exist) { pvc->state.new = new; pvc->state.active = active; pvc->state.bandwidth = bw; pvc_carrier(active, pvc); fr_log_dlci_active(pvc); } } i += stat_len; } pvc = state(hdlc)->first_pvc; while (pvc) { if (pvc->state.deleted && pvc->state.exist) { pvc_carrier(0, pvc); pvc->state.active = pvc->state.new = 0; pvc->state.exist = 0; pvc->state.bandwidth = 0; fr_log_dlci_active(pvc); } pvc = pvc->next; } /* Next full report after N391 polls */ state(hdlc)->n391cnt = state(hdlc)->settings.n391; return 0; }
DoS
0
static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb) { hdlc_device *hdlc = dev_to_hdlc(dev); pvc_device *pvc; u8 rxseq, txseq; int lmi = state(hdlc)->settings.lmi; int dce = state(hdlc)->settings.dce; int stat_len = (lmi == LMI_CISCO) ? 6 : 3, reptype, error, no_ram, i; if (skb->len < (lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH)) { netdev_info(dev, "Short LMI frame\n"); return 1; } if (skb->data[3] != (lmi == LMI_CISCO ? NLPID_CISCO_LMI : NLPID_CCITT_ANSI_LMI)) { netdev_info(dev, "Received non-LMI frame with LMI DLCI\n"); return 1; } if (skb->data[4] != LMI_CALLREF) { netdev_info(dev, "Invalid LMI Call reference (0x%02X)\n", skb->data[4]); return 1; } if (skb->data[5] != (dce ? LMI_STATUS_ENQUIRY : LMI_STATUS)) { netdev_info(dev, "Invalid LMI Message type (0x%02X)\n", skb->data[5]); return 1; } if (lmi == LMI_ANSI) { if (skb->data[6] != LMI_ANSI_LOCKSHIFT) { netdev_info(dev, "Not ANSI locking shift in LMI message (0x%02X)\n", skb->data[6]); return 1; } i = 7; } else i = 6; if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_REPTYPE : LMI_ANSI_CISCO_REPTYPE)) { netdev_info(dev, "Not an LMI Report type IE (0x%02X)\n", skb->data[i]); return 1; } if (skb->data[++i] != LMI_REPT_LEN) { netdev_info(dev, "Invalid LMI Report type IE length (%u)\n", skb->data[i]); return 1; } reptype = skb->data[++i]; if (reptype != LMI_INTEGRITY && reptype != LMI_FULLREP) { netdev_info(dev, "Unsupported LMI Report type (0x%02X)\n", reptype); return 1; } if (skb->data[++i] != (lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE)) { netdev_info(dev, "Not an LMI Link integrity verification IE (0x%02X)\n", skb->data[i]); return 1; } if (skb->data[++i] != LMI_INTEG_LEN) { netdev_info(dev, "Invalid LMI Link integrity verification IE length (%u)\n", skb->data[i]); return 1; } i++; state(hdlc)->rxseq = skb->data[i++]; /* TX sequence from peer */ rxseq = skb->data[i++]; /* Should confirm our sequence */ txseq = state(hdlc)->txseq; if (dce) state(hdlc)->last_poll = jiffies; error = 0; if (!state(hdlc)->reliable) error = 1; if (rxseq == 0 || rxseq != txseq) { /* Ask for full report next time */ state(hdlc)->n391cnt = 0; error = 1; } if (dce) { if (state(hdlc)->fullrep_sent && !error) { /* Stop sending full report - the last one has been confirmed by DTE */ state(hdlc)->fullrep_sent = 0; pvc = state(hdlc)->first_pvc; while (pvc) { if (pvc->state.new) { pvc->state.new = 0; /* Tell DTE that new PVC is now active */ state(hdlc)->dce_changed = 1; } pvc = pvc->next; } } if (state(hdlc)->dce_changed) { reptype = LMI_FULLREP; state(hdlc)->fullrep_sent = 1; state(hdlc)->dce_changed = 0; } state(hdlc)->request = 1; /* got request */ fr_lmi_send(dev, reptype == LMI_FULLREP ? 1 : 0); return 0; } /* DTE */ state(hdlc)->request = 0; /* got response, no request pending */ if (error) return 0; if (reptype != LMI_FULLREP) return 0; pvc = state(hdlc)->first_pvc; while (pvc) { pvc->state.deleted = 1; pvc = pvc->next; } no_ram = 0; while (skb->len >= i + 2 + stat_len) { u16 dlci; u32 bw; unsigned int active, new; if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT : LMI_ANSI_CISCO_PVCSTAT)) { netdev_info(dev, "Not an LMI PVC status IE (0x%02X)\n", skb->data[i]); return 1; } if (skb->data[++i] != stat_len) { netdev_info(dev, "Invalid LMI PVC status IE length (%u)\n", skb->data[i]); return 1; } i++; new = !! (skb->data[i + 2] & 0x08); active = !! (skb->data[i + 2] & 0x02); if (lmi == LMI_CISCO) { dlci = (skb->data[i] << 8) | skb->data[i + 1]; bw = (skb->data[i + 3] << 16) | (skb->data[i + 4] << 8) | (skb->data[i + 5]); } else { dlci = ((skb->data[i] & 0x3F) << 4) | ((skb->data[i + 1] & 0x78) >> 3); bw = 0; } pvc = add_pvc(dev, dlci); if (!pvc && !no_ram) { netdev_warn(dev, "Memory squeeze on fr_lmi_recv()\n"); no_ram = 1; } if (pvc) { pvc->state.exist = 1; pvc->state.deleted = 0; if (active != pvc->state.active || new != pvc->state.new || bw != pvc->state.bandwidth || !pvc->state.exist) { pvc->state.new = new; pvc->state.active = active; pvc->state.bandwidth = bw; pvc_carrier(active, pvc); fr_log_dlci_active(pvc); } } i += stat_len; } pvc = state(hdlc)->first_pvc; while (pvc) { if (pvc->state.deleted && pvc->state.exist) { pvc_carrier(0, pvc); pvc->state.active = pvc->state.new = 0; pvc->state.exist = 0; pvc->state.bandwidth = 0; fr_log_dlci_active(pvc); } pvc = pvc->next; } /* Next full report after N391 polls */ state(hdlc)->n391cnt = state(hdlc)->settings.n391; return 0; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,115
static void fr_lmi_send(struct net_device *dev, int fullrep) { hdlc_device *hdlc = dev_to_hdlc(dev); struct sk_buff *skb; pvc_device *pvc = state(hdlc)->first_pvc; int lmi = state(hdlc)->settings.lmi; int dce = state(hdlc)->settings.dce; int len = lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH; int stat_len = (lmi == LMI_CISCO) ? 6 : 3; u8 *data; int i = 0; if (dce && fullrep) { len += state(hdlc)->dce_pvc_count * (2 + stat_len); if (len > HDLC_MAX_MRU) { netdev_warn(dev, "Too many PVCs while sending LMI full report\n"); return; } } skb = dev_alloc_skb(len); if (!skb) { netdev_warn(dev, "Memory squeeze on fr_lmi_send()\n"); return; } memset(skb->data, 0, len); skb_reserve(skb, 4); if (lmi == LMI_CISCO) { skb->protocol = cpu_to_be16(NLPID_CISCO_LMI); fr_hard_header(&skb, LMI_CISCO_DLCI); } else { skb->protocol = cpu_to_be16(NLPID_CCITT_ANSI_LMI); fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); } data = skb_tail_pointer(skb); data[i++] = LMI_CALLREF; data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; if (lmi == LMI_ANSI) data[i++] = LMI_ANSI_LOCKSHIFT; data[i++] = lmi == LMI_CCITT ? LMI_CCITT_REPTYPE : LMI_ANSI_CISCO_REPTYPE; data[i++] = LMI_REPT_LEN; data[i++] = fullrep ? LMI_FULLREP : LMI_INTEGRITY; data[i++] = lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE; data[i++] = LMI_INTEG_LEN; data[i++] = state(hdlc)->txseq = fr_lmi_nextseq(state(hdlc)->txseq); data[i++] = state(hdlc)->rxseq; if (dce && fullrep) { while (pvc) { data[i++] = lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT : LMI_ANSI_CISCO_PVCSTAT; data[i++] = stat_len; /* LMI start/restart */ if (state(hdlc)->reliable && !pvc->state.exist) { pvc->state.exist = pvc->state.new = 1; fr_log_dlci_active(pvc); } /* ifconfig PVC up */ if (pvc->open_count && !pvc->state.active && pvc->state.exist && !pvc->state.new) { pvc_carrier(1, pvc); pvc->state.active = 1; fr_log_dlci_active(pvc); } if (lmi == LMI_CISCO) { data[i] = pvc->dlci >> 8; data[i + 1] = pvc->dlci & 0xFF; } else { data[i] = (pvc->dlci >> 4) & 0x3F; data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80; data[i + 2] = 0x80; } if (pvc->state.new) data[i + 2] |= 0x08; else if (pvc->state.active) data[i + 2] |= 0x02; i += stat_len; pvc = pvc->next; } } skb_put(skb, i); skb->priority = TC_PRIO_CONTROL; skb->dev = dev; skb_reset_network_header(skb); dev_queue_xmit(skb); }
DoS
0
static void fr_lmi_send(struct net_device *dev, int fullrep) { hdlc_device *hdlc = dev_to_hdlc(dev); struct sk_buff *skb; pvc_device *pvc = state(hdlc)->first_pvc; int lmi = state(hdlc)->settings.lmi; int dce = state(hdlc)->settings.dce; int len = lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH; int stat_len = (lmi == LMI_CISCO) ? 6 : 3; u8 *data; int i = 0; if (dce && fullrep) { len += state(hdlc)->dce_pvc_count * (2 + stat_len); if (len > HDLC_MAX_MRU) { netdev_warn(dev, "Too many PVCs while sending LMI full report\n"); return; } } skb = dev_alloc_skb(len); if (!skb) { netdev_warn(dev, "Memory squeeze on fr_lmi_send()\n"); return; } memset(skb->data, 0, len); skb_reserve(skb, 4); if (lmi == LMI_CISCO) { skb->protocol = cpu_to_be16(NLPID_CISCO_LMI); fr_hard_header(&skb, LMI_CISCO_DLCI); } else { skb->protocol = cpu_to_be16(NLPID_CCITT_ANSI_LMI); fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); } data = skb_tail_pointer(skb); data[i++] = LMI_CALLREF; data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; if (lmi == LMI_ANSI) data[i++] = LMI_ANSI_LOCKSHIFT; data[i++] = lmi == LMI_CCITT ? LMI_CCITT_REPTYPE : LMI_ANSI_CISCO_REPTYPE; data[i++] = LMI_REPT_LEN; data[i++] = fullrep ? LMI_FULLREP : LMI_INTEGRITY; data[i++] = lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE; data[i++] = LMI_INTEG_LEN; data[i++] = state(hdlc)->txseq = fr_lmi_nextseq(state(hdlc)->txseq); data[i++] = state(hdlc)->rxseq; if (dce && fullrep) { while (pvc) { data[i++] = lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT : LMI_ANSI_CISCO_PVCSTAT; data[i++] = stat_len; /* LMI start/restart */ if (state(hdlc)->reliable && !pvc->state.exist) { pvc->state.exist = pvc->state.new = 1; fr_log_dlci_active(pvc); } /* ifconfig PVC up */ if (pvc->open_count && !pvc->state.active && pvc->state.exist && !pvc->state.new) { pvc_carrier(1, pvc); pvc->state.active = 1; fr_log_dlci_active(pvc); } if (lmi == LMI_CISCO) { data[i] = pvc->dlci >> 8; data[i + 1] = pvc->dlci & 0xFF; } else { data[i] = (pvc->dlci >> 4) & 0x3F; data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80; data[i + 2] = 0x80; } if (pvc->state.new) data[i + 2] |= 0x08; else if (pvc->state.active) data[i + 2] |= 0x02; i += stat_len; pvc = pvc->next; } } skb_put(skb, i); skb->priority = TC_PRIO_CONTROL; skb->dev = dev; skb_reset_network_header(skb); dev_queue_xmit(skb); }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,116
static inline void fr_log_dlci_active(pvc_device *pvc) { netdev_info(pvc->frad, "DLCI %d [%s%s%s]%s %s\n", pvc->dlci, pvc->main ? pvc->main->name : "", pvc->main && pvc->ether ? " " : "", pvc->ether ? pvc->ether->name : "", pvc->state.new ? " new" : "", !pvc->state.exist ? "deleted" : pvc->state.active ? "active" : "inactive"); }
DoS
0
static inline void fr_log_dlci_active(pvc_device *pvc) { netdev_info(pvc->frad, "DLCI %d [%s%s%s]%s %s\n", pvc->dlci, pvc->main ? pvc->main->name : "", pvc->main && pvc->ether ? " " : "", pvc->ether ? pvc->ether->name : "", pvc->state.new ? " new" : "", !pvc->state.exist ? "deleted" : pvc->state.active ? "active" : "inactive"); }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,117
static void fr_set_link_state(int reliable, struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); pvc_device *pvc = state(hdlc)->first_pvc; state(hdlc)->reliable = reliable; if (reliable) { netif_dormant_off(dev); state(hdlc)->n391cnt = 0; /* Request full status */ state(hdlc)->dce_changed = 1; if (state(hdlc)->settings.lmi == LMI_NONE) { while (pvc) { /* Activate all PVCs */ pvc_carrier(1, pvc); pvc->state.exist = pvc->state.active = 1; pvc->state.new = 0; pvc = pvc->next; } } } else { netif_dormant_on(dev); while (pvc) { /* Deactivate all PVCs */ pvc_carrier(0, pvc); pvc->state.exist = pvc->state.active = 0; pvc->state.new = 0; if (!state(hdlc)->settings.dce) pvc->state.bandwidth = 0; pvc = pvc->next; } } }
DoS
0
static void fr_set_link_state(int reliable, struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); pvc_device *pvc = state(hdlc)->first_pvc; state(hdlc)->reliable = reliable; if (reliable) { netif_dormant_off(dev); state(hdlc)->n391cnt = 0; /* Request full status */ state(hdlc)->dce_changed = 1; if (state(hdlc)->settings.lmi == LMI_NONE) { while (pvc) { /* Activate all PVCs */ pvc_carrier(1, pvc); pvc->state.exist = pvc->state.active = 1; pvc->state.new = 0; pvc = pvc->next; } } } else { netif_dormant_on(dev); while (pvc) { /* Deactivate all PVCs */ pvc_carrier(0, pvc); pvc->state.exist = pvc->state.active = 0; pvc->state.new = 0; if (!state(hdlc)->settings.dce) pvc->state.bandwidth = 0; pvc = pvc->next; } } }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,118
static void fr_start(struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); #ifdef DEBUG_LINK printk(KERN_DEBUG "fr_start\n"); #endif if (state(hdlc)->settings.lmi != LMI_NONE) { state(hdlc)->reliable = 0; state(hdlc)->dce_changed = 1; state(hdlc)->request = 0; state(hdlc)->fullrep_sent = 0; state(hdlc)->last_errors = 0xFFFFFFFF; state(hdlc)->n391cnt = 0; state(hdlc)->txseq = state(hdlc)->rxseq = 0; init_timer(&state(hdlc)->timer); /* First poll after 1 s */ state(hdlc)->timer.expires = jiffies + HZ; state(hdlc)->timer.function = fr_timer; state(hdlc)->timer.data = (unsigned long)dev; add_timer(&state(hdlc)->timer); } else fr_set_link_state(1, dev); }
DoS
0
static void fr_start(struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); #ifdef DEBUG_LINK printk(KERN_DEBUG "fr_start\n"); #endif if (state(hdlc)->settings.lmi != LMI_NONE) { state(hdlc)->reliable = 0; state(hdlc)->dce_changed = 1; state(hdlc)->request = 0; state(hdlc)->fullrep_sent = 0; state(hdlc)->last_errors = 0xFFFFFFFF; state(hdlc)->n391cnt = 0; state(hdlc)->txseq = state(hdlc)->rxseq = 0; init_timer(&state(hdlc)->timer); /* First poll after 1 s */ state(hdlc)->timer.expires = jiffies + HZ; state(hdlc)->timer.function = fr_timer; state(hdlc)->timer.data = (unsigned long)dev; add_timer(&state(hdlc)->timer); } else fr_set_link_state(1, dev); }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,119
static void fr_timer(unsigned long arg) { struct net_device *dev = (struct net_device *)arg; hdlc_device *hdlc = dev_to_hdlc(dev); int i, cnt = 0, reliable; u32 list; if (state(hdlc)->settings.dce) { reliable = state(hdlc)->request && time_before(jiffies, state(hdlc)->last_poll + state(hdlc)->settings.t392 * HZ); state(hdlc)->request = 0; } else { state(hdlc)->last_errors <<= 1; /* Shift the list */ if (state(hdlc)->request) { if (state(hdlc)->reliable) netdev_info(dev, "No LMI status reply received\n"); state(hdlc)->last_errors |= 1; } list = state(hdlc)->last_errors; for (i = 0; i < state(hdlc)->settings.n393; i++, list >>= 1) cnt += (list & 1); /* errors count */ reliable = (cnt < state(hdlc)->settings.n392); } if (state(hdlc)->reliable != reliable) { netdev_info(dev, "Link %sreliable\n", reliable ? "" : "un"); fr_set_link_state(reliable, dev); } if (state(hdlc)->settings.dce) state(hdlc)->timer.expires = jiffies + state(hdlc)->settings.t392 * HZ; else { if (state(hdlc)->n391cnt) state(hdlc)->n391cnt--; fr_lmi_send(dev, state(hdlc)->n391cnt == 0); state(hdlc)->last_poll = jiffies; state(hdlc)->request = 1; state(hdlc)->timer.expires = jiffies + state(hdlc)->settings.t391 * HZ; } state(hdlc)->timer.function = fr_timer; state(hdlc)->timer.data = arg; add_timer(&state(hdlc)->timer); }
DoS
0
static void fr_timer(unsigned long arg) { struct net_device *dev = (struct net_device *)arg; hdlc_device *hdlc = dev_to_hdlc(dev); int i, cnt = 0, reliable; u32 list; if (state(hdlc)->settings.dce) { reliable = state(hdlc)->request && time_before(jiffies, state(hdlc)->last_poll + state(hdlc)->settings.t392 * HZ); state(hdlc)->request = 0; } else { state(hdlc)->last_errors <<= 1; /* Shift the list */ if (state(hdlc)->request) { if (state(hdlc)->reliable) netdev_info(dev, "No LMI status reply received\n"); state(hdlc)->last_errors |= 1; } list = state(hdlc)->last_errors; for (i = 0; i < state(hdlc)->settings.n393; i++, list >>= 1) cnt += (list & 1); /* errors count */ reliable = (cnt < state(hdlc)->settings.n392); } if (state(hdlc)->reliable != reliable) { netdev_info(dev, "Link %sreliable\n", reliable ? "" : "un"); fr_set_link_state(reliable, dev); } if (state(hdlc)->settings.dce) state(hdlc)->timer.expires = jiffies + state(hdlc)->settings.t392 * HZ; else { if (state(hdlc)->n391cnt) state(hdlc)->n391cnt--; fr_lmi_send(dev, state(hdlc)->n391cnt == 0); state(hdlc)->last_poll = jiffies; state(hdlc)->request = 1; state(hdlc)->timer.expires = jiffies + state(hdlc)->settings.t391 * HZ; } state(hdlc)->timer.function = fr_timer; state(hdlc)->timer.data = arg; add_timer(&state(hdlc)->timer); }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,120
static inline struct net_device** get_dev_p(pvc_device *pvc, int type) { if (type == ARPHRD_ETHER) return &pvc->ether; else return &pvc->main; }
DoS
0
static inline struct net_device** get_dev_p(pvc_device *pvc, int type) { if (type == ARPHRD_ETHER) return &pvc->ether; else return &pvc->main; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,121
static void __exit mod_exit(void) { unregister_hdlc_protocol(&proto); }
DoS
0
static void __exit mod_exit(void) { unregister_hdlc_protocol(&proto); }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,122
static int __init mod_init(void) { register_hdlc_protocol(&proto); return 0; }
DoS
0
static int __init mod_init(void) { register_hdlc_protocol(&proto); return 0; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,123
static inline void pvc_carrier(int on, pvc_device *pvc) { if (on) { if (pvc->main) if (!netif_carrier_ok(pvc->main)) netif_carrier_on(pvc->main); if (pvc->ether) if (!netif_carrier_ok(pvc->ether)) netif_carrier_on(pvc->ether); } else { if (pvc->main) if (netif_carrier_ok(pvc->main)) netif_carrier_off(pvc->main); if (pvc->ether) if (netif_carrier_ok(pvc->ether)) netif_carrier_off(pvc->ether); } }
DoS
0
static inline void pvc_carrier(int on, pvc_device *pvc) { if (on) { if (pvc->main) if (!netif_carrier_ok(pvc->main)) netif_carrier_on(pvc->main); if (pvc->ether) if (!netif_carrier_ok(pvc->ether)) netif_carrier_on(pvc->ether); } else { if (pvc->main) if (netif_carrier_ok(pvc->main)) netif_carrier_off(pvc->main); if (pvc->ether) if (netif_carrier_ok(pvc->ether)) netif_carrier_off(pvc->ether); } }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,124
static int pvc_close(struct net_device *dev) { pvc_device *pvc = dev->ml_priv; if (--pvc->open_count == 0) { hdlc_device *hdlc = dev_to_hdlc(pvc->frad); if (state(hdlc)->settings.lmi == LMI_NONE) pvc->state.active = 0; if (state(hdlc)->settings.dce) { state(hdlc)->dce_changed = 1; pvc->state.active = 0; } } return 0; }
DoS
0
static int pvc_close(struct net_device *dev) { pvc_device *pvc = dev->ml_priv; if (--pvc->open_count == 0) { hdlc_device *hdlc = dev_to_hdlc(pvc->frad); if (state(hdlc)->settings.lmi == LMI_NONE) pvc->state.active = 0; if (state(hdlc)->settings.dce) { state(hdlc)->dce_changed = 1; pvc->state.active = 0; } } return 0; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,125
static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { pvc_device *pvc = dev->ml_priv; fr_proto_pvc_info info; if (ifr->ifr_settings.type == IF_GET_PROTO) { if (dev->type == ARPHRD_ETHER) ifr->ifr_settings.type = IF_PROTO_FR_ETH_PVC; else ifr->ifr_settings.type = IF_PROTO_FR_PVC; if (ifr->ifr_settings.size < sizeof(info)) { /* data size wanted */ ifr->ifr_settings.size = sizeof(info); return -ENOBUFS; } info.dlci = pvc->dlci; memcpy(info.master, pvc->frad->name, IFNAMSIZ); if (copy_to_user(ifr->ifr_settings.ifs_ifsu.fr_pvc_info, &info, sizeof(info))) return -EFAULT; return 0; } return -EINVAL; }
DoS
0
static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { pvc_device *pvc = dev->ml_priv; fr_proto_pvc_info info; if (ifr->ifr_settings.type == IF_GET_PROTO) { if (dev->type == ARPHRD_ETHER) ifr->ifr_settings.type = IF_PROTO_FR_ETH_PVC; else ifr->ifr_settings.type = IF_PROTO_FR_PVC; if (ifr->ifr_settings.size < sizeof(info)) { /* data size wanted */ ifr->ifr_settings.size = sizeof(info); return -ENOBUFS; } info.dlci = pvc->dlci; memcpy(info.master, pvc->frad->name, IFNAMSIZ); if (copy_to_user(ifr->ifr_settings.ifs_ifsu.fr_pvc_info, &info, sizeof(info))) return -EFAULT; return 0; } return -EINVAL; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,126
static inline int pvc_is_used(pvc_device *pvc) { return pvc->main || pvc->ether; }
DoS
0
static inline int pvc_is_used(pvc_device *pvc) { return pvc->main || pvc->ether; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,127
static void pvc_setup(struct net_device *dev) { dev->type = ARPHRD_DLCI; dev->flags = IFF_POINTOPOINT; dev->hard_header_len = 10; dev->addr_len = 2; dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; }
DoS
0
static void pvc_setup(struct net_device *dev) { dev->type = ARPHRD_DLCI; dev->flags = IFF_POINTOPOINT; dev->hard_header_len = 10; dev->addr_len = 2; dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,128
static inline u16 q922_to_dlci(u8 *hdr) { return ((hdr[0] & 0xFC) << 2) | ((hdr[1] & 0xF0) >> 4); }
DoS
0
static inline u16 q922_to_dlci(u8 *hdr) { return ((hdr[0] & 0xFC) << 2) | ((hdr[1] & 0xF0) >> 4); }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,129
static inline struct frad_state* state(hdlc_device *hdlc) { return(struct frad_state *)(hdlc->state); }
DoS
0
static inline struct frad_state* state(hdlc_device *hdlc) { return(struct frad_state *)(hdlc->state); }
@@ -1074,9 +1074,10 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { dev = alloc_netdev(0, "pvceth%d", ether_setup); - else + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + } else dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) {
CWE-264
null
null
19,130
static void OUT4500( struct airo_info *ai, u16 reg, u16 val ) { if (test_bit(FLAG_MPI,&ai->flags)) reg <<= 1; if ( !do8bitIO ) outw( val, ai->dev->base_addr + reg ); else { outb( val & 0xff, ai->dev->base_addr + reg ); outb( val >> 8, ai->dev->base_addr + reg + 1 ); } }
DoS
0
static void OUT4500( struct airo_info *ai, u16 reg, u16 val ) { if (test_bit(FLAG_MPI,&ai->flags)) reg <<= 1; if ( !do8bitIO ) outw( val, ai->dev->base_addr + reg ); else { outb( val & 0xff, ai->dev->base_addr + reg ); outb( val >> 8, ai->dev->base_addr + reg + 1 ); } }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,131
static int PC4500_accessrid(struct airo_info *ai, u16 rid, u16 accmd) { Cmd cmd; /* for issuing commands */ Resp rsp; /* response from commands */ u16 status; memset(&cmd, 0, sizeof(cmd)); cmd.cmd = accmd; cmd.parm0 = rid; status = issuecommand(ai, &cmd, &rsp); if (status != 0) return status; if ( (rsp.status & 0x7F00) != 0) { return (accmd << 8) + (rsp.rsp0 & 0xFF); } return 0; }
DoS
0
static int PC4500_accessrid(struct airo_info *ai, u16 rid, u16 accmd) { Cmd cmd; /* for issuing commands */ Resp rsp; /* response from commands */ u16 status; memset(&cmd, 0, sizeof(cmd)); cmd.cmd = accmd; cmd.parm0 = rid; status = issuecommand(ai, &cmd, &rsp); if (status != 0) return status; if ( (rsp.status & 0x7F00) != 0) { return (accmd << 8) + (rsp.rsp0 & 0xFF); } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,132
static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, int lock) { u16 status; int rc = SUCCESS; if (lock) { if (down_interruptible(&ai->sem)) return ERROR; } if (test_bit(FLAG_MPI,&ai->flags)) { Cmd cmd; Resp rsp; memset(&cmd, 0, sizeof(cmd)); memset(&rsp, 0, sizeof(rsp)); ai->config_desc.rid_desc.valid = 1; ai->config_desc.rid_desc.len = RIDSIZE; ai->config_desc.rid_desc.rid = 0; ai->config_desc.rid_desc.host_addr = ai->ridbus; cmd.cmd = CMD_ACCESS; cmd.parm0 = rid; memcpy_toio(ai->config_desc.card_ram_off, &ai->config_desc.rid_desc, sizeof(Rid)); rc = issuecommand(ai, &cmd, &rsp); if (rsp.status & 0x7f00) rc = rsp.rsp0; if (!rc) memcpy(pBuf, ai->config_desc.virtual_host_addr, len); goto done; } else { if ((status = PC4500_accessrid(ai, rid, CMD_ACCESS))!=SUCCESS) { rc = status; goto done; } if (bap_setup(ai, rid, 0, BAP1) != SUCCESS) { rc = ERROR; goto done; } bap_read(ai, pBuf, 2, BAP1); len = min(len, (int)le16_to_cpu(*(__le16*)pBuf)) - 2; if ( len <= 2 ) { airo_print_err(ai->dev->name, "Rid %x has a length of %d which is too short", (int)rid, (int)len ); rc = ERROR; goto done; } rc = bap_read(ai, ((__le16*)pBuf)+1, len, BAP1); } done: if (lock) up(&ai->sem); return rc; }
DoS
0
static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, int lock) { u16 status; int rc = SUCCESS; if (lock) { if (down_interruptible(&ai->sem)) return ERROR; } if (test_bit(FLAG_MPI,&ai->flags)) { Cmd cmd; Resp rsp; memset(&cmd, 0, sizeof(cmd)); memset(&rsp, 0, sizeof(rsp)); ai->config_desc.rid_desc.valid = 1; ai->config_desc.rid_desc.len = RIDSIZE; ai->config_desc.rid_desc.rid = 0; ai->config_desc.rid_desc.host_addr = ai->ridbus; cmd.cmd = CMD_ACCESS; cmd.parm0 = rid; memcpy_toio(ai->config_desc.card_ram_off, &ai->config_desc.rid_desc, sizeof(Rid)); rc = issuecommand(ai, &cmd, &rsp); if (rsp.status & 0x7f00) rc = rsp.rsp0; if (!rc) memcpy(pBuf, ai->config_desc.virtual_host_addr, len); goto done; } else { if ((status = PC4500_accessrid(ai, rid, CMD_ACCESS))!=SUCCESS) { rc = status; goto done; } if (bap_setup(ai, rid, 0, BAP1) != SUCCESS) { rc = ERROR; goto done; } bap_read(ai, pBuf, 2, BAP1); len = min(len, (int)le16_to_cpu(*(__le16*)pBuf)) - 2; if ( len <= 2 ) { airo_print_err(ai->dev->name, "Rid %x has a length of %d which is too short", (int)rid, (int)len ); rc = ERROR; goto done; } rc = bap_read(ai, ((__le16*)pBuf)+1, len, BAP1); } done: if (lock) up(&ai->sem); return rc; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,133
static int PC4500_writerid(struct airo_info *ai, u16 rid, const void *pBuf, int len, int lock) { u16 status; int rc = SUCCESS; *(__le16*)pBuf = cpu_to_le16((u16)len); if (lock) { if (down_interruptible(&ai->sem)) return ERROR; } if (test_bit(FLAG_MPI,&ai->flags)) { Cmd cmd; Resp rsp; if (test_bit(FLAG_ENABLED, &ai->flags) && (RID_WEP_TEMP != rid)) airo_print_err(ai->dev->name, "%s: MAC should be disabled (rid=%04x)", __func__, rid); memset(&cmd, 0, sizeof(cmd)); memset(&rsp, 0, sizeof(rsp)); ai->config_desc.rid_desc.valid = 1; ai->config_desc.rid_desc.len = *((u16 *)pBuf); ai->config_desc.rid_desc.rid = 0; cmd.cmd = CMD_WRITERID; cmd.parm0 = rid; memcpy_toio(ai->config_desc.card_ram_off, &ai->config_desc.rid_desc, sizeof(Rid)); if (len < 4 || len > 2047) { airo_print_err(ai->dev->name, "%s: len=%d", __func__, len); rc = -1; } else { memcpy((char *)ai->config_desc.virtual_host_addr, pBuf, len); rc = issuecommand(ai, &cmd, &rsp); if ((rc & 0xff00) != 0) { airo_print_err(ai->dev->name, "%s: Write rid Error %d", __func__, rc); airo_print_err(ai->dev->name, "%s: Cmd=%04x", __func__, cmd.cmd); } if ((rsp.status & 0x7f00)) rc = rsp.rsp0; } } else { if ( (status = PC4500_accessrid(ai, rid, CMD_ACCESS)) != 0) { rc = status; goto done; } if (bap_setup(ai, rid, 0, BAP1) != SUCCESS) { rc = ERROR; goto done; } bap_write(ai, pBuf, len, BAP1); rc = PC4500_accessrid(ai, rid, 0x100|CMD_ACCESS); } done: if (lock) up(&ai->sem); return rc; }
DoS
0
static int PC4500_writerid(struct airo_info *ai, u16 rid, const void *pBuf, int len, int lock) { u16 status; int rc = SUCCESS; *(__le16*)pBuf = cpu_to_le16((u16)len); if (lock) { if (down_interruptible(&ai->sem)) return ERROR; } if (test_bit(FLAG_MPI,&ai->flags)) { Cmd cmd; Resp rsp; if (test_bit(FLAG_ENABLED, &ai->flags) && (RID_WEP_TEMP != rid)) airo_print_err(ai->dev->name, "%s: MAC should be disabled (rid=%04x)", __func__, rid); memset(&cmd, 0, sizeof(cmd)); memset(&rsp, 0, sizeof(rsp)); ai->config_desc.rid_desc.valid = 1; ai->config_desc.rid_desc.len = *((u16 *)pBuf); ai->config_desc.rid_desc.rid = 0; cmd.cmd = CMD_WRITERID; cmd.parm0 = rid; memcpy_toio(ai->config_desc.card_ram_off, &ai->config_desc.rid_desc, sizeof(Rid)); if (len < 4 || len > 2047) { airo_print_err(ai->dev->name, "%s: len=%d", __func__, len); rc = -1; } else { memcpy((char *)ai->config_desc.virtual_host_addr, pBuf, len); rc = issuecommand(ai, &cmd, &rsp); if ((rc & 0xff00) != 0) { airo_print_err(ai->dev->name, "%s: Write rid Error %d", __func__, rc); airo_print_err(ai->dev->name, "%s: Cmd=%04x", __func__, cmd.cmd); } if ((rsp.status & 0x7f00)) rc = rsp.rsp0; } } else { if ( (status = PC4500_accessrid(ai, rid, CMD_ACCESS)) != 0) { rc = status; goto done; } if (bap_setup(ai, rid, 0, BAP1) != SUCCESS) { rc = ERROR; goto done; } bap_write(ai, pBuf, len, BAP1); rc = PC4500_accessrid(ai, rid, 0x100|CMD_ACCESS); } done: if (lock) up(&ai->sem); return rc; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,134
static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq) { u32 seq,index; if (mcast) { if (test_bit(FLAG_UPDATE_MULTI, &ai->flags)) { clear_bit (FLAG_UPDATE_MULTI, &ai->flags); context->window = (micSeq > 33) ? micSeq : 33; context->rx = 0; // Reset rx } } else if (test_bit(FLAG_UPDATE_UNI, &ai->flags)) { clear_bit (FLAG_UPDATE_UNI, &ai->flags); context->window = (micSeq > 33) ? micSeq : 33; // Move window context->rx = 0; // Reset rx } seq = micSeq - (context->window - 33); if ((s32)seq < 0) return ERROR; if ( seq > 64 ) { MoveWindow(context,micSeq); return SUCCESS; } seq >>= 1; //divide by 2 because we only have odd numbers index = 1 << seq; //Get an index number if (!(context->rx & index)) { context->rx |= index; MoveWindow(context,micSeq); return SUCCESS; } return ERROR; }
DoS
0
static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq) { u32 seq,index; if (mcast) { if (test_bit(FLAG_UPDATE_MULTI, &ai->flags)) { clear_bit (FLAG_UPDATE_MULTI, &ai->flags); context->window = (micSeq > 33) ? micSeq : 33; context->rx = 0; // Reset rx } } else if (test_bit(FLAG_UPDATE_UNI, &ai->flags)) { clear_bit (FLAG_UPDATE_UNI, &ai->flags); context->window = (micSeq > 33) ? micSeq : 33; // Move window context->rx = 0; // Reset rx } seq = micSeq - (context->window - 33); if ((s32)seq < 0) return ERROR; if ( seq > 64 ) { MoveWindow(context,micSeq); return SUCCESS; } seq >>= 1; //divide by 2 because we only have odd numbers index = 1 << seq; //Get an index number if (!(context->rx & index)) { context->rx |= index; MoveWindow(context,micSeq); return SUCCESS; } return ERROR; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,135
static void add_airo_dev(struct airo_info *ai) { /* Upper layers already keep track of PCI devices, * so we only need to remember our non-PCI cards. */ if (!ai->pci) list_add_tail(&ai->dev_list, &airo_devices); }
DoS
0
static void add_airo_dev(struct airo_info *ai) { /* Upper layers already keep track of PCI devices, * so we only need to remember our non-PCI cards. */ if (!ai->pci) list_add_tail(&ai->dev_list, &airo_devices); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,136
static int airo_change_mtu(struct net_device *dev, int new_mtu) { if ((new_mtu < 68) || (new_mtu > 2400)) return -EINVAL; dev->mtu = new_mtu; return 0; }
DoS
0
static int airo_change_mtu(struct net_device *dev, int new_mtu) { if ((new_mtu < 68) || (new_mtu > 2400)) return -EINVAL; dev->mtu = new_mtu; return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,137
static void __exit airo_cleanup_module( void ) { struct airo_info *ai; while(!list_empty(&airo_devices)) { ai = list_entry(airo_devices.next, struct airo_info, dev_list); airo_print_info(ai->dev->name, "Unregistering..."); stop_airo_card(ai->dev, 1); } #ifdef CONFIG_PCI pci_unregister_driver(&airo_driver); #endif remove_proc_entry("driver/aironet", NULL); }
DoS
0
static void __exit airo_cleanup_module( void ) { struct airo_info *ai; while(!list_empty(&airo_devices)) { ai = list_entry(airo_devices.next, struct airo_info, dev_list); airo_print_info(ai->dev->name, "Unregistering..."); stop_airo_card(ai->dev, 1); } #ifdef CONFIG_PCI pci_unregister_driver(&airo_driver); #endif remove_proc_entry("driver/aironet", NULL); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,138
static int airo_close(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; netif_stop_queue(dev); if (ai->wifidev != dev) { #ifdef POWER_ON_DOWN /* Shut power to the card. The idea is that the user can save * power when he doesn't need the card with "ifconfig down". * That's the method that is most friendly towards the network * stack (i.e. the network stack won't try to broadcast * anything on the interface and routes are gone. Jean II */ set_bit(FLAG_RADIO_DOWN, &ai->flags); disable_MAC(ai, 1); #endif disable_interrupts( ai ); free_irq(dev->irq, dev); set_bit(JOB_DIE, &ai->jobs); kthread_stop(ai->airo_thread_task); } return 0; }
DoS
0
static int airo_close(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; netif_stop_queue(dev); if (ai->wifidev != dev) { #ifdef POWER_ON_DOWN /* Shut power to the card. The idea is that the user can save * power when he doesn't need the card with "ifconfig down". * That's the method that is most friendly towards the network * stack (i.e. the network stack won't try to broadcast * anything on the interface and routes are gone. Jean II */ set_bit(FLAG_RADIO_DOWN, &ai->flags); disable_MAC(ai, 1); #endif disable_interrupts( ai ); free_irq(dev->irq, dev); set_bit(JOB_DIE, &ai->jobs); kthread_stop(ai->airo_thread_task); } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,139
static int airo_config_commit(struct net_device *dev, struct iw_request_info *info, /* NULL */ void *zwrq, /* NULL */ char *extra) /* NULL */ { struct airo_info *local = dev->ml_priv; if (!test_bit (FLAG_COMMIT, &local->flags)) return 0; /* Some of the "SET" function may have modified some of the * parameters. It's now time to commit them in the card */ disable_MAC(local, 1); if (test_bit (FLAG_RESET, &local->flags)) { APListRid APList_rid; SsidRid SSID_rid; readAPListRid(local, &APList_rid); readSsidRid(local, &SSID_rid); if (test_bit(FLAG_MPI,&local->flags)) setup_card(local, dev->dev_addr, 1 ); else reset_airo_card(dev); disable_MAC(local, 1); writeSsidRid(local, &SSID_rid, 1); writeAPListRid(local, &APList_rid, 1); } if (down_interruptible(&local->sem)) return -ERESTARTSYS; writeConfigRid(local, 0); enable_MAC(local, 0); if (test_bit (FLAG_RESET, &local->flags)) airo_set_promisc(local); else up(&local->sem); return 0; }
DoS
0
static int airo_config_commit(struct net_device *dev, struct iw_request_info *info, /* NULL */ void *zwrq, /* NULL */ char *extra) /* NULL */ { struct airo_info *local = dev->ml_priv; if (!test_bit (FLAG_COMMIT, &local->flags)) return 0; /* Some of the "SET" function may have modified some of the * parameters. It's now time to commit them in the card */ disable_MAC(local, 1); if (test_bit (FLAG_RESET, &local->flags)) { APListRid APList_rid; SsidRid SSID_rid; readAPListRid(local, &APList_rid); readSsidRid(local, &SSID_rid); if (test_bit(FLAG_MPI,&local->flags)) setup_card(local, dev->dev_addr, 1 ); else reset_airo_card(dev); disable_MAC(local, 1); writeSsidRid(local, &SSID_rid, 1); writeAPListRid(local, &APList_rid, 1); } if (down_interruptible(&local->sem)) return -ERESTARTSYS; writeConfigRid(local, 0); enable_MAC(local, 0); if (test_bit (FLAG_RESET, &local->flags)) airo_set_promisc(local); else up(&local->sem); return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,140
static void airo_end_xmit11(struct net_device *dev) { u16 status; int i; struct airo_info *priv = dev->ml_priv; struct sk_buff *skb = priv->xmit11.skb; int fid = priv->xmit11.fid; u32 *fids = priv->fids; clear_bit(JOB_XMIT11, &priv->jobs); clear_bit(FLAG_PENDING_XMIT11, &priv->flags); status = transmit_802_11_packet (priv, fids[fid], skb->data); up(&priv->sem); i = MAX_FIDS / 2; if ( status == SUCCESS ) { dev->trans_start = jiffies; for (; i < MAX_FIDS && (priv->fids[i] & 0xffff0000); i++); } else { priv->fids[fid] &= 0xffff; dev->stats.tx_window_errors++; } if (i < MAX_FIDS) netif_wake_queue(dev); dev_kfree_skb(skb); }
DoS
0
static void airo_end_xmit11(struct net_device *dev) { u16 status; int i; struct airo_info *priv = dev->ml_priv; struct sk_buff *skb = priv->xmit11.skb; int fid = priv->xmit11.fid; u32 *fids = priv->fids; clear_bit(JOB_XMIT11, &priv->jobs); clear_bit(FLAG_PENDING_XMIT11, &priv->flags); status = transmit_802_11_packet (priv, fids[fid], skb->data); up(&priv->sem); i = MAX_FIDS / 2; if ( status == SUCCESS ) { dev->trans_start = jiffies; for (; i < MAX_FIDS && (priv->fids[i] & 0xffff0000); i++); } else { priv->fids[fid] &= 0xffff; dev->stats.tx_window_errors++; } if (i < MAX_FIDS) netif_wake_queue(dev); dev_kfree_skb(skb); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,141
static int airo_get_aplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; struct sockaddr *address = (struct sockaddr *) extra; struct iw_quality *qual; BSSListRid BSSList; int i; int loseSync = capable(CAP_NET_ADMIN) ? 1: -1; qual = kmalloc(IW_MAX_AP * sizeof(*qual), GFP_KERNEL); if (!qual) return -ENOMEM; for (i = 0; i < IW_MAX_AP; i++) { u16 dBm; if (readBSSListRid(local, loseSync, &BSSList)) break; loseSync = 0; memcpy(address[i].sa_data, BSSList.bssid, ETH_ALEN); address[i].sa_family = ARPHRD_ETHER; dBm = le16_to_cpu(BSSList.dBm); if (local->rssi) { qual[i].level = 0x100 - dBm; qual[i].qual = airo_dbm_to_pct(local->rssi, dBm); qual[i].updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | IW_QUAL_DBM; } else { qual[i].level = (dBm + 321) / 2; qual[i].qual = 0; qual[i].updated = IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_UPDATED | IW_QUAL_DBM; } qual[i].noise = local->wstats.qual.noise; if (BSSList.index == cpu_to_le16(0xffff)) break; } if (!i) { StatusRid status_rid; /* Card status info */ readStatusRid(local, &status_rid, 1); for (i = 0; i < min(IW_MAX_AP, 4) && (status_rid.bssid[i][0] & status_rid.bssid[i][1] & status_rid.bssid[i][2] & status_rid.bssid[i][3] & status_rid.bssid[i][4] & status_rid.bssid[i][5])!=0xff && (status_rid.bssid[i][0] | status_rid.bssid[i][1] | status_rid.bssid[i][2] | status_rid.bssid[i][3] | status_rid.bssid[i][4] | status_rid.bssid[i][5]); i++) { memcpy(address[i].sa_data, status_rid.bssid[i], ETH_ALEN); address[i].sa_family = ARPHRD_ETHER; } } else { dwrq->flags = 1; /* Should be define'd */ memcpy(extra + sizeof(struct sockaddr)*i, &qual, sizeof(struct iw_quality)*i); } dwrq->length = i; kfree(qual); return 0; }
DoS
0
static int airo_get_aplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; struct sockaddr *address = (struct sockaddr *) extra; struct iw_quality *qual; BSSListRid BSSList; int i; int loseSync = capable(CAP_NET_ADMIN) ? 1: -1; qual = kmalloc(IW_MAX_AP * sizeof(*qual), GFP_KERNEL); if (!qual) return -ENOMEM; for (i = 0; i < IW_MAX_AP; i++) { u16 dBm; if (readBSSListRid(local, loseSync, &BSSList)) break; loseSync = 0; memcpy(address[i].sa_data, BSSList.bssid, ETH_ALEN); address[i].sa_family = ARPHRD_ETHER; dBm = le16_to_cpu(BSSList.dBm); if (local->rssi) { qual[i].level = 0x100 - dBm; qual[i].qual = airo_dbm_to_pct(local->rssi, dBm); qual[i].updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | IW_QUAL_DBM; } else { qual[i].level = (dBm + 321) / 2; qual[i].qual = 0; qual[i].updated = IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_UPDATED | IW_QUAL_DBM; } qual[i].noise = local->wstats.qual.noise; if (BSSList.index == cpu_to_le16(0xffff)) break; } if (!i) { StatusRid status_rid; /* Card status info */ readStatusRid(local, &status_rid, 1); for (i = 0; i < min(IW_MAX_AP, 4) && (status_rid.bssid[i][0] & status_rid.bssid[i][1] & status_rid.bssid[i][2] & status_rid.bssid[i][3] & status_rid.bssid[i][4] & status_rid.bssid[i][5])!=0xff && (status_rid.bssid[i][0] | status_rid.bssid[i][1] | status_rid.bssid[i][2] | status_rid.bssid[i][3] | status_rid.bssid[i][4] | status_rid.bssid[i][5]); i++) { memcpy(address[i].sa_data, status_rid.bssid[i], ETH_ALEN); address[i].sa_family = ARPHRD_ETHER; } } else { dwrq->flags = 1; /* Should be define'd */ memcpy(extra + sizeof(struct sockaddr)*i, &qual, sizeof(struct iw_quality)*i); } dwrq->length = i; kfree(qual); return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,142
static int airo_get_auth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct airo_info *local = dev->ml_priv; struct iw_param *param = &wrqu->param; __le16 currentAuthType = local->config.authType; switch (param->flags & IW_AUTH_INDEX) { case IW_AUTH_DROP_UNENCRYPTED: switch (currentAuthType) { case AUTH_SHAREDKEY: case AUTH_ENCRYPT: param->value = 1; break; default: param->value = 0; break; } break; case IW_AUTH_80211_AUTH_ALG: switch (currentAuthType) { case AUTH_SHAREDKEY: param->value = IW_AUTH_ALG_SHARED_KEY; break; case AUTH_ENCRYPT: default: param->value = IW_AUTH_ALG_OPEN_SYSTEM; break; } break; case IW_AUTH_WPA_ENABLED: param->value = 0; break; default: return -EOPNOTSUPP; } return 0; }
DoS
0
static int airo_get_auth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct airo_info *local = dev->ml_priv; struct iw_param *param = &wrqu->param; __le16 currentAuthType = local->config.authType; switch (param->flags & IW_AUTH_INDEX) { case IW_AUTH_DROP_UNENCRYPTED: switch (currentAuthType) { case AUTH_SHAREDKEY: case AUTH_ENCRYPT: param->value = 1; break; default: param->value = 0; break; } break; case IW_AUTH_80211_AUTH_ALG: switch (currentAuthType) { case AUTH_SHAREDKEY: param->value = IW_AUTH_ALG_SHARED_KEY; break; case AUTH_ENCRYPT: default: param->value = IW_AUTH_ALG_OPEN_SYSTEM; break; } break; case IW_AUTH_WPA_ENABLED: param->value = 0; break; default: return -EOPNOTSUPP; } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,143
static int airo_get_encode(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; int wep_key_len; u8 buf[16]; if (!local->wep_capable) return -EOPNOTSUPP; readConfigRid(local, 1); /* Check encryption mode */ switch(local->config.authType) { case AUTH_ENCRYPT: dwrq->flags = IW_ENCODE_OPEN; break; case AUTH_SHAREDKEY: dwrq->flags = IW_ENCODE_RESTRICTED; break; default: case AUTH_OPEN: dwrq->flags = IW_ENCODE_DISABLED; break; } /* We can't return the key, so set the proper flag and return zero */ dwrq->flags |= IW_ENCODE_NOKEY; memset(extra, 0, 16); /* Which key do we want ? -1 -> tx index */ if (!valid_index(local, index)) { index = get_wep_tx_idx(local); if (index < 0) index = 0; } dwrq->flags |= index + 1; /* Copy the key to the user buffer */ wep_key_len = get_wep_key(local, index, &buf[0], sizeof(buf)); if (wep_key_len < 0) { dwrq->length = 0; } else { dwrq->length = wep_key_len; memcpy(extra, buf, dwrq->length); } return 0; }
DoS
0
static int airo_get_encode(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; int wep_key_len; u8 buf[16]; if (!local->wep_capable) return -EOPNOTSUPP; readConfigRid(local, 1); /* Check encryption mode */ switch(local->config.authType) { case AUTH_ENCRYPT: dwrq->flags = IW_ENCODE_OPEN; break; case AUTH_SHAREDKEY: dwrq->flags = IW_ENCODE_RESTRICTED; break; default: case AUTH_OPEN: dwrq->flags = IW_ENCODE_DISABLED; break; } /* We can't return the key, so set the proper flag and return zero */ dwrq->flags |= IW_ENCODE_NOKEY; memset(extra, 0, 16); /* Which key do we want ? -1 -> tx index */ if (!valid_index(local, index)) { index = get_wep_tx_idx(local); if (index < 0) index = 0; } dwrq->flags |= index + 1; /* Copy the key to the user buffer */ wep_key_len = get_wep_key(local, index, &buf[0], sizeof(buf)); if (wep_key_len < 0) { dwrq->length = 0; } else { dwrq->length = wep_key_len; memcpy(extra, buf, dwrq->length); } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,144
static int airo_get_encodeext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct airo_info *local = dev->ml_priv; struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int idx, max_key_len, wep_key_len; u8 buf[16]; if (!local->wep_capable) return -EOPNOTSUPP; readConfigRid(local, 1); max_key_len = encoding->length - sizeof(*ext); if (max_key_len < 0) return -EINVAL; idx = encoding->flags & IW_ENCODE_INDEX; if (idx) { if (!valid_index(local, idx - 1)) return -EINVAL; idx--; } else { idx = get_wep_tx_idx(local); if (idx < 0) idx = 0; } encoding->flags = idx + 1; memset(ext, 0, sizeof(*ext)); /* Check encryption mode */ switch(local->config.authType) { case AUTH_ENCRYPT: encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; break; case AUTH_SHAREDKEY: encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; break; default: case AUTH_OPEN: encoding->flags = IW_ENCODE_ALG_NONE | IW_ENCODE_DISABLED; break; } /* We can't return the key, so set the proper flag and return zero */ encoding->flags |= IW_ENCODE_NOKEY; memset(extra, 0, 16); /* Copy the key to the user buffer */ wep_key_len = get_wep_key(local, idx, &buf[0], sizeof(buf)); if (wep_key_len < 0) { ext->key_len = 0; } else { ext->key_len = wep_key_len; memcpy(extra, buf, ext->key_len); } return 0; }
DoS
0
static int airo_get_encodeext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct airo_info *local = dev->ml_priv; struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int idx, max_key_len, wep_key_len; u8 buf[16]; if (!local->wep_capable) return -EOPNOTSUPP; readConfigRid(local, 1); max_key_len = encoding->length - sizeof(*ext); if (max_key_len < 0) return -EINVAL; idx = encoding->flags & IW_ENCODE_INDEX; if (idx) { if (!valid_index(local, idx - 1)) return -EINVAL; idx--; } else { idx = get_wep_tx_idx(local); if (idx < 0) idx = 0; } encoding->flags = idx + 1; memset(ext, 0, sizeof(*ext)); /* Check encryption mode */ switch(local->config.authType) { case AUTH_ENCRYPT: encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; break; case AUTH_SHAREDKEY: encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; break; default: case AUTH_OPEN: encoding->flags = IW_ENCODE_ALG_NONE | IW_ENCODE_DISABLED; break; } /* We can't return the key, so set the proper flag and return zero */ encoding->flags |= IW_ENCODE_NOKEY; memset(extra, 0, 16); /* Copy the key to the user buffer */ wep_key_len = get_wep_key(local, idx, &buf[0], sizeof(buf)); if (wep_key_len < 0) { ext->key_len = 0; } else { ext->key_len = wep_key_len; memcpy(extra, buf, ext->key_len); } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,145
static int airo_get_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { struct airo_info *local = dev->ml_priv; StatusRid status_rid; /* Card status info */ int ch; readConfigRid(local, 1); if ((local->config.opmode & MODE_CFG_MASK) == MODE_STA_ESS) status_rid.channel = local->config.channelSet; else readStatusRid(local, &status_rid, 1); ch = le16_to_cpu(status_rid.channel); if((ch > 0) && (ch < 15)) { fwrq->m = ieee80211_dsss_chan_to_freq(ch) * 100000; fwrq->e = 1; } else { fwrq->m = ch; fwrq->e = 0; } return 0; }
DoS
0
static int airo_get_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { struct airo_info *local = dev->ml_priv; StatusRid status_rid; /* Card status info */ int ch; readConfigRid(local, 1); if ((local->config.opmode & MODE_CFG_MASK) == MODE_STA_ESS) status_rid.channel = local->config.channelSet; else readStatusRid(local, &status_rid, 1); ch = le16_to_cpu(status_rid.channel); if((ch > 0) && (ch < 15)) { fwrq->m = ieee80211_dsss_chan_to_freq(ch) * 100000; fwrq->e = 1; } else { fwrq->m = ch; fwrq->e = 0; } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,146
static int airo_get_mode(struct net_device *dev, struct iw_request_info *info, __u32 *uwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); /* If not managed, assume it's ad-hoc */ switch (local->config.opmode & MODE_CFG_MASK) { case MODE_STA_ESS: *uwrq = IW_MODE_INFRA; break; case MODE_AP: *uwrq = IW_MODE_MASTER; break; case MODE_AP_RPTR: *uwrq = IW_MODE_REPEAT; break; default: *uwrq = IW_MODE_ADHOC; } return 0; }
DoS
0
static int airo_get_mode(struct net_device *dev, struct iw_request_info *info, __u32 *uwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); /* If not managed, assume it's ad-hoc */ switch (local->config.opmode & MODE_CFG_MASK) { case MODE_STA_ESS: *uwrq = IW_MODE_INFRA; break; case MODE_AP: *uwrq = IW_MODE_MASTER; break; case MODE_AP_RPTR: *uwrq = IW_MODE_REPEAT; break; default: *uwrq = IW_MODE_ADHOC; } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,147
static int airo_get_name(struct net_device *dev, struct iw_request_info *info, char *cwrq, char *extra) { strcpy(cwrq, "IEEE 802.11-DS"); return 0; }
DoS
0
static int airo_get_name(struct net_device *dev, struct iw_request_info *info, char *cwrq, char *extra) { strcpy(cwrq, "IEEE 802.11-DS"); return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,148
static int airo_get_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; __le16 mode; readConfigRid(local, 1); mode = local->config.powerSaveMode; if ((vwrq->disabled = (mode == POWERSAVE_CAM))) return 0; if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { vwrq->value = le16_to_cpu(local->config.fastListenDelay) * 1024; vwrq->flags = IW_POWER_TIMEOUT; } else { vwrq->value = le16_to_cpu(local->config.fastListenInterval) * 1024; vwrq->flags = IW_POWER_PERIOD; } if ((local->config.rmode & RXMODE_MASK) == RXMODE_ADDR) vwrq->flags |= IW_POWER_UNICAST_R; else vwrq->flags |= IW_POWER_ALL_R; return 0; }
DoS
0
static int airo_get_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; __le16 mode; readConfigRid(local, 1); mode = local->config.powerSaveMode; if ((vwrq->disabled = (mode == POWERSAVE_CAM))) return 0; if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { vwrq->value = le16_to_cpu(local->config.fastListenDelay) * 1024; vwrq->flags = IW_POWER_TIMEOUT; } else { vwrq->value = le16_to_cpu(local->config.fastListenInterval) * 1024; vwrq->flags = IW_POWER_PERIOD; } if ((local->config.rmode & RXMODE_MASK) == RXMODE_ADDR) vwrq->flags |= IW_POWER_UNICAST_R; else vwrq->flags |= IW_POWER_ALL_R; return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,149
static int airo_get_retry(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; vwrq->disabled = 0; /* Can't be disabled */ readConfigRid(local, 1); /* Note : by default, display the min retry number */ if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { vwrq->flags = IW_RETRY_LIFETIME; vwrq->value = le16_to_cpu(local->config.txLifetime) * 1024; } else if((vwrq->flags & IW_RETRY_LONG)) { vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; vwrq->value = le16_to_cpu(local->config.longRetryLimit); } else { vwrq->flags = IW_RETRY_LIMIT; vwrq->value = le16_to_cpu(local->config.shortRetryLimit); if(local->config.shortRetryLimit != local->config.longRetryLimit) vwrq->flags |= IW_RETRY_SHORT; } return 0; }
DoS
0
static int airo_get_retry(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; vwrq->disabled = 0; /* Can't be disabled */ readConfigRid(local, 1); /* Note : by default, display the min retry number */ if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { vwrq->flags = IW_RETRY_LIFETIME; vwrq->value = le16_to_cpu(local->config.txLifetime) * 1024; } else if((vwrq->flags & IW_RETRY_LONG)) { vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; vwrq->value = le16_to_cpu(local->config.longRetryLimit); } else { vwrq->flags = IW_RETRY_LIMIT; vwrq->value = le16_to_cpu(local->config.shortRetryLimit); if(local->config.shortRetryLimit != local->config.longRetryLimit) vwrq->flags |= IW_RETRY_SHORT; } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,150
static int airo_get_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); vwrq->value = le16_to_cpu(local->config.rtsThres); vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); vwrq->fixed = 1; return 0; }
DoS
0
static int airo_get_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); vwrq->value = le16_to_cpu(local->config.rtsThres); vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); vwrq->fixed = 1; return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,151
static int airo_get_scan(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *ai = dev->ml_priv; BSSListElement *net; int err = 0; char *current_ev = extra; /* If a scan is in-progress, return -EAGAIN */ if (ai->scan_timeout > 0) return -EAGAIN; if (down_interruptible(&ai->sem)) return -EAGAIN; list_for_each_entry (net, &ai->network_list, list) { /* Translate to WE format this entry */ current_ev = airo_translate_scan(dev, info, current_ev, extra + dwrq->length, &net->bss); /* Check if there is space for one more entry */ if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { /* Ask user space to try again with a bigger buffer */ err = -E2BIG; goto out; } } /* Length of data */ dwrq->length = (current_ev - extra); dwrq->flags = 0; /* todo */ out: up(&ai->sem); return err; }
DoS
0
static int airo_get_scan(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *ai = dev->ml_priv; BSSListElement *net; int err = 0; char *current_ev = extra; /* If a scan is in-progress, return -EAGAIN */ if (ai->scan_timeout > 0) return -EAGAIN; if (down_interruptible(&ai->sem)) return -EAGAIN; list_for_each_entry (net, &ai->network_list, list) { /* Translate to WE format this entry */ current_ev = airo_translate_scan(dev, info, current_ev, extra + dwrq->length, &net->bss); /* Check if there is space for one more entry */ if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { /* Ask user space to try again with a bigger buffer */ err = -E2BIG; goto out; } } /* Length of data */ dwrq->length = (current_ev - extra); dwrq->flags = 0; /* todo */ out: up(&ai->sem); return err; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,152
static int airo_get_sens(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); vwrq->value = le16_to_cpu(local->config.rssiThreshold); vwrq->disabled = (vwrq->value == 0); vwrq->fixed = 1; return 0; }
DoS
0
static int airo_get_sens(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); vwrq->value = le16_to_cpu(local->config.rssiThreshold); vwrq->disabled = (vwrq->value == 0); vwrq->fixed = 1; return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,153
static struct net_device_stats *airo_get_stats(struct net_device *dev) { struct airo_info *local = dev->ml_priv; if (!test_bit(JOB_STATS, &local->jobs)) { /* Get stats out of the card if available */ if (down_trylock(&local->sem) != 0) { set_bit(JOB_STATS, &local->jobs); wake_up_interruptible(&local->thr_wait); } else airo_read_stats(dev); } return &dev->stats; }
DoS
0
static struct net_device_stats *airo_get_stats(struct net_device *dev) { struct airo_info *local = dev->ml_priv; if (!test_bit(JOB_STATS, &local->jobs)) { /* Get stats out of the card if available */ if (down_trylock(&local->sem) != 0) { set_bit(JOB_STATS, &local->jobs); wake_up_interruptible(&local->thr_wait); } else airo_read_stats(dev); } return &dev->stats; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,154
static int airo_get_txpow(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); vwrq->value = le16_to_cpu(local->config.txPower); vwrq->fixed = 1; /* No power control */ vwrq->disabled = test_bit(FLAG_RADIO_OFF, &local->flags); vwrq->flags = IW_TXPOW_MWATT; return 0; }
DoS
0
static int airo_get_txpow(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); vwrq->value = le16_to_cpu(local->config.txPower); vwrq->fixed = 1; /* No power control */ vwrq->disabled = test_bit(FLAG_RADIO_OFF, &local->flags); vwrq->flags = IW_TXPOW_MWATT; return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,155
static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev) { struct airo_info *local = dev->ml_priv; if (!test_bit(JOB_WSTATS, &local->jobs)) { /* Get stats out of the card if available */ if (down_trylock(&local->sem) != 0) { set_bit(JOB_WSTATS, &local->jobs); wake_up_interruptible(&local->thr_wait); } else airo_read_wireless_stats(local); } return &local->wstats; }
DoS
0
static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev) { struct airo_info *local = dev->ml_priv; if (!test_bit(JOB_WSTATS, &local->jobs)) { /* Get stats out of the card if available */ if (down_trylock(&local->sem) != 0) { set_bit(JOB_WSTATS, &local->jobs); wake_up_interruptible(&local->thr_wait); } else airo_read_wireless_stats(local); } return &local->wstats; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,156
static void airo_handle_cisco_mic(struct airo_info *ai) { if (test_bit(FLAG_MIC_CAPABLE, &ai->flags)) { set_bit(JOB_MIC, &ai->jobs); wake_up_interruptible(&ai->thr_wait); } }
DoS
0
static void airo_handle_cisco_mic(struct airo_info *ai) { if (test_bit(FLAG_MIC_CAPABLE, &ai->flags)) { set_bit(JOB_MIC, &ai->jobs); wake_up_interruptible(&ai->thr_wait); } }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,157
static void airo_handle_rx(struct airo_info *ai) { struct sk_buff *skb = NULL; __le16 fc, v, *buffer, tmpbuf[4]; u16 len, hdrlen = 0, gap, fid; struct rx_hdr hdr; int success = 0; if (test_bit(FLAG_MPI, &ai->flags)) { if (test_bit(FLAG_802_11, &ai->flags)) mpi_receive_802_11(ai); else mpi_receive_802_3(ai); OUT4500(ai, EVACK, EV_RX); return; } fid = IN4500(ai, RXFID); /* Get the packet length */ if (test_bit(FLAG_802_11, &ai->flags)) { bap_setup (ai, fid, 4, BAP0); bap_read (ai, (__le16*)&hdr, sizeof(hdr), BAP0); /* Bad CRC. Ignore packet */ if (le16_to_cpu(hdr.status) & 2) hdr.len = 0; if (ai->wifidev == NULL) hdr.len = 0; } else { bap_setup(ai, fid, 0x36, BAP0); bap_read(ai, &hdr.len, 2, BAP0); } len = le16_to_cpu(hdr.len); if (len > AIRO_DEF_MTU) { airo_print_err(ai->dev->name, "Bad size %d", len); goto done; } if (len == 0) goto done; if (test_bit(FLAG_802_11, &ai->flags)) { bap_read(ai, &fc, sizeof (fc), BAP0); hdrlen = header_len(fc); } else hdrlen = ETH_ALEN * 2; skb = dev_alloc_skb(len + hdrlen + 2 + 2); if (!skb) { ai->dev->stats.rx_dropped++; goto done; } skb_reserve(skb, 2); /* This way the IP header is aligned */ buffer = (__le16 *) skb_put(skb, len + hdrlen); if (test_bit(FLAG_802_11, &ai->flags)) { buffer[0] = fc; bap_read(ai, buffer + 1, hdrlen - 2, BAP0); if (hdrlen == 24) bap_read(ai, tmpbuf, 6, BAP0); bap_read(ai, &v, sizeof(v), BAP0); gap = le16_to_cpu(v); if (gap) { if (gap <= 8) { bap_read(ai, tmpbuf, gap, BAP0); } else { airo_print_err(ai->dev->name, "gaplen too " "big. Problems will follow..."); } } bap_read(ai, buffer + hdrlen/2, len, BAP0); } else { MICBuffer micbuf; bap_read(ai, buffer, ETH_ALEN * 2, BAP0); if (ai->micstats.enabled) { bap_read(ai, (__le16 *) &micbuf, sizeof (micbuf), BAP0); if (ntohs(micbuf.typelen) > 0x05DC) bap_setup(ai, fid, 0x44, BAP0); else { if (len <= sizeof (micbuf)) { dev_kfree_skb_irq(skb); goto done; } len -= sizeof(micbuf); skb_trim(skb, len + hdrlen); } } bap_read(ai, buffer + ETH_ALEN, len, BAP0); if (decapsulate(ai, &micbuf, (etherHead*) buffer, len)) dev_kfree_skb_irq (skb); else success = 1; } #ifdef WIRELESS_SPY if (success && (ai->spy_data.spy_number > 0)) { char *sa; struct iw_quality wstats; /* Prepare spy data : addr + qual */ if (!test_bit(FLAG_802_11, &ai->flags)) { sa = (char *) buffer + 6; bap_setup(ai, fid, 8, BAP0); bap_read(ai, (__le16 *) hdr.rssi, 2, BAP0); } else sa = (char *) buffer + 10; wstats.qual = hdr.rssi[0]; if (ai->rssi) wstats.level = 0x100 - ai->rssi[hdr.rssi[1]].rssidBm; else wstats.level = (hdr.rssi[1] + 321) / 2; wstats.noise = ai->wstats.qual.noise; wstats.updated = IW_QUAL_LEVEL_UPDATED | IW_QUAL_QUAL_UPDATED | IW_QUAL_DBM; /* Update spy records */ wireless_spy_update(ai->dev, sa, &wstats); } #endif /* WIRELESS_SPY */ done: OUT4500(ai, EVACK, EV_RX); if (success) { if (test_bit(FLAG_802_11, &ai->flags)) { skb_reset_mac_header(skb); skb->pkt_type = PACKET_OTHERHOST; skb->dev = ai->wifidev; skb->protocol = htons(ETH_P_802_2); } else skb->protocol = eth_type_trans(skb, ai->dev); skb->ip_summed = CHECKSUM_NONE; netif_rx(skb); } }
DoS
0
static void airo_handle_rx(struct airo_info *ai) { struct sk_buff *skb = NULL; __le16 fc, v, *buffer, tmpbuf[4]; u16 len, hdrlen = 0, gap, fid; struct rx_hdr hdr; int success = 0; if (test_bit(FLAG_MPI, &ai->flags)) { if (test_bit(FLAG_802_11, &ai->flags)) mpi_receive_802_11(ai); else mpi_receive_802_3(ai); OUT4500(ai, EVACK, EV_RX); return; } fid = IN4500(ai, RXFID); /* Get the packet length */ if (test_bit(FLAG_802_11, &ai->flags)) { bap_setup (ai, fid, 4, BAP0); bap_read (ai, (__le16*)&hdr, sizeof(hdr), BAP0); /* Bad CRC. Ignore packet */ if (le16_to_cpu(hdr.status) & 2) hdr.len = 0; if (ai->wifidev == NULL) hdr.len = 0; } else { bap_setup(ai, fid, 0x36, BAP0); bap_read(ai, &hdr.len, 2, BAP0); } len = le16_to_cpu(hdr.len); if (len > AIRO_DEF_MTU) { airo_print_err(ai->dev->name, "Bad size %d", len); goto done; } if (len == 0) goto done; if (test_bit(FLAG_802_11, &ai->flags)) { bap_read(ai, &fc, sizeof (fc), BAP0); hdrlen = header_len(fc); } else hdrlen = ETH_ALEN * 2; skb = dev_alloc_skb(len + hdrlen + 2 + 2); if (!skb) { ai->dev->stats.rx_dropped++; goto done; } skb_reserve(skb, 2); /* This way the IP header is aligned */ buffer = (__le16 *) skb_put(skb, len + hdrlen); if (test_bit(FLAG_802_11, &ai->flags)) { buffer[0] = fc; bap_read(ai, buffer + 1, hdrlen - 2, BAP0); if (hdrlen == 24) bap_read(ai, tmpbuf, 6, BAP0); bap_read(ai, &v, sizeof(v), BAP0); gap = le16_to_cpu(v); if (gap) { if (gap <= 8) { bap_read(ai, tmpbuf, gap, BAP0); } else { airo_print_err(ai->dev->name, "gaplen too " "big. Problems will follow..."); } } bap_read(ai, buffer + hdrlen/2, len, BAP0); } else { MICBuffer micbuf; bap_read(ai, buffer, ETH_ALEN * 2, BAP0); if (ai->micstats.enabled) { bap_read(ai, (__le16 *) &micbuf, sizeof (micbuf), BAP0); if (ntohs(micbuf.typelen) > 0x05DC) bap_setup(ai, fid, 0x44, BAP0); else { if (len <= sizeof (micbuf)) { dev_kfree_skb_irq(skb); goto done; } len -= sizeof(micbuf); skb_trim(skb, len + hdrlen); } } bap_read(ai, buffer + ETH_ALEN, len, BAP0); if (decapsulate(ai, &micbuf, (etherHead*) buffer, len)) dev_kfree_skb_irq (skb); else success = 1; } #ifdef WIRELESS_SPY if (success && (ai->spy_data.spy_number > 0)) { char *sa; struct iw_quality wstats; /* Prepare spy data : addr + qual */ if (!test_bit(FLAG_802_11, &ai->flags)) { sa = (char *) buffer + 6; bap_setup(ai, fid, 8, BAP0); bap_read(ai, (__le16 *) hdr.rssi, 2, BAP0); } else sa = (char *) buffer + 10; wstats.qual = hdr.rssi[0]; if (ai->rssi) wstats.level = 0x100 - ai->rssi[hdr.rssi[1]].rssidBm; else wstats.level = (hdr.rssi[1] + 321) / 2; wstats.noise = ai->wstats.qual.noise; wstats.updated = IW_QUAL_LEVEL_UPDATED | IW_QUAL_QUAL_UPDATED | IW_QUAL_DBM; /* Update spy records */ wireless_spy_update(ai->dev, sa, &wstats); } #endif /* WIRELESS_SPY */ done: OUT4500(ai, EVACK, EV_RX); if (success) { if (test_bit(FLAG_802_11, &ai->flags)) { skb_reset_mac_header(skb); skb->pkt_type = PACKET_OTHERHOST; skb->dev = ai->wifidev; skb->protocol = htons(ETH_P_802_2); } else skb->protocol = eth_type_trans(skb, ai->dev); skb->ip_summed = CHECKSUM_NONE; netif_rx(skb); } }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,158
static void airo_handle_tx(struct airo_info *ai, u16 status) { int i, len = 0, index = -1; u16 fid; if (test_bit(FLAG_MPI, &ai->flags)) { unsigned long flags; if (status & EV_TXEXC) get_tx_error(ai, -1); spin_lock_irqsave(&ai->aux_lock, flags); if (!skb_queue_empty(&ai->txq)) { spin_unlock_irqrestore(&ai->aux_lock,flags); mpi_send_packet(ai->dev); } else { clear_bit(FLAG_PENDING_XMIT, &ai->flags); spin_unlock_irqrestore(&ai->aux_lock,flags); netif_wake_queue(ai->dev); } OUT4500(ai, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC)); return; } fid = IN4500(ai, TXCOMPLFID); for(i = 0; i < MAX_FIDS; i++) { if ((ai->fids[i] & 0xffff) == fid) { len = ai->fids[i] >> 16; index = i; } } if (index != -1) { if (status & EV_TXEXC) get_tx_error(ai, index); OUT4500(ai, EVACK, status & (EV_TX | EV_TXEXC)); /* Set up to be used again */ ai->fids[index] &= 0xffff; if (index < MAX_FIDS / 2) { if (!test_bit(FLAG_PENDING_XMIT, &ai->flags)) netif_wake_queue(ai->dev); } else { if (!test_bit(FLAG_PENDING_XMIT11, &ai->flags)) netif_wake_queue(ai->wifidev); } } else { OUT4500(ai, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC)); airo_print_err(ai->dev->name, "Unallocated FID was used to xmit"); } }
DoS
0
static void airo_handle_tx(struct airo_info *ai, u16 status) { int i, len = 0, index = -1; u16 fid; if (test_bit(FLAG_MPI, &ai->flags)) { unsigned long flags; if (status & EV_TXEXC) get_tx_error(ai, -1); spin_lock_irqsave(&ai->aux_lock, flags); if (!skb_queue_empty(&ai->txq)) { spin_unlock_irqrestore(&ai->aux_lock,flags); mpi_send_packet(ai->dev); } else { clear_bit(FLAG_PENDING_XMIT, &ai->flags); spin_unlock_irqrestore(&ai->aux_lock,flags); netif_wake_queue(ai->dev); } OUT4500(ai, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC)); return; } fid = IN4500(ai, TXCOMPLFID); for(i = 0; i < MAX_FIDS; i++) { if ((ai->fids[i] & 0xffff) == fid) { len = ai->fids[i] >> 16; index = i; } } if (index != -1) { if (status & EV_TXEXC) get_tx_error(ai, index); OUT4500(ai, EVACK, status & (EV_TX | EV_TXEXC)); /* Set up to be used again */ ai->fids[index] &= 0xffff; if (index < MAX_FIDS / 2) { if (!test_bit(FLAG_PENDING_XMIT, &ai->flags)) netif_wake_queue(ai->dev); } else { if (!test_bit(FLAG_PENDING_XMIT11, &ai->flags)) netif_wake_queue(ai->wifidev); } } else { OUT4500(ai, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC)); airo_print_err(ai->dev->name, "Unallocated FID was used to xmit"); } }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,159
static int __init airo_init_module( void ) { int i; airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL); if (airo_entry) { airo_entry->uid = proc_uid; airo_entry->gid = proc_gid; } for (i = 0; i < 4 && io[i] && irq[i]; i++) { airo_print_info("", "Trying to configure ISA adapter at irq=%d " "io=0x%x", irq[i], io[i] ); if (init_airo_card( irq[i], io[i], 0, NULL )) /* do nothing */ ; } #ifdef CONFIG_PCI airo_print_info("", "Probing for PCI adapters"); i = pci_register_driver(&airo_driver); airo_print_info("", "Finished probing for PCI adapters"); if (i) { remove_proc_entry("driver/aironet", NULL); return i; } #endif /* Always exit with success, as we are a library module * as well as a driver module */ return 0; }
DoS
0
static int __init airo_init_module( void ) { int i; airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL); if (airo_entry) { airo_entry->uid = proc_uid; airo_entry->gid = proc_gid; } for (i = 0; i < 4 && io[i] && irq[i]; i++) { airo_print_info("", "Trying to configure ISA adapter at irq=%d " "io=0x%x", irq[i], io[i] ); if (init_airo_card( irq[i], io[i], 0, NULL )) /* do nothing */ ; } #ifdef CONFIG_PCI airo_print_info("", "Probing for PCI adapters"); i = pci_register_driver(&airo_driver); airo_print_info("", "Finished probing for PCI adapters"); if (i) { remove_proc_entry("driver/aironet", NULL); return i; } #endif /* Always exit with success, as we are a library module * as well as a driver module */ return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,160
static irqreturn_t airo_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; u16 status, savedInterrupts = 0; struct airo_info *ai = dev->ml_priv; int handled = 0; if (!netif_device_present(dev)) return IRQ_NONE; for (;;) { status = IN4500(ai, EVSTAT); if (!(status & STATUS_INTS) || (status == 0xffff)) break; handled = 1; if (status & EV_AWAKE) { OUT4500(ai, EVACK, EV_AWAKE); OUT4500(ai, EVACK, EV_AWAKE); } if (!savedInterrupts) { savedInterrupts = IN4500(ai, EVINTEN); OUT4500(ai, EVINTEN, 0); } if (status & EV_MIC) { OUT4500(ai, EVACK, EV_MIC); airo_handle_cisco_mic(ai); } if (status & EV_LINK) { /* Link status changed */ airo_handle_link(ai); } /* Check to see if there is something to receive */ if (status & EV_RX) airo_handle_rx(ai); /* Check to see if a packet has been transmitted */ if (status & (EV_TX | EV_TXCPY | EV_TXEXC)) airo_handle_tx(ai, status); if ( status & ~STATUS_INTS & ~IGNORE_INTS ) { airo_print_warn(ai->dev->name, "Got weird status %x", status & ~STATUS_INTS & ~IGNORE_INTS ); } } if (savedInterrupts) OUT4500(ai, EVINTEN, savedInterrupts); return IRQ_RETVAL(handled); }
DoS
0
static irqreturn_t airo_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; u16 status, savedInterrupts = 0; struct airo_info *ai = dev->ml_priv; int handled = 0; if (!netif_device_present(dev)) return IRQ_NONE; for (;;) { status = IN4500(ai, EVSTAT); if (!(status & STATUS_INTS) || (status == 0xffff)) break; handled = 1; if (status & EV_AWAKE) { OUT4500(ai, EVACK, EV_AWAKE); OUT4500(ai, EVACK, EV_AWAKE); } if (!savedInterrupts) { savedInterrupts = IN4500(ai, EVINTEN); OUT4500(ai, EVINTEN, 0); } if (status & EV_MIC) { OUT4500(ai, EVACK, EV_MIC); airo_handle_cisco_mic(ai); } if (status & EV_LINK) { /* Link status changed */ airo_handle_link(ai); } /* Check to see if there is something to receive */ if (status & EV_RX) airo_handle_rx(ai); /* Check to see if a packet has been transmitted */ if (status & (EV_TX | EV_TXCPY | EV_TXEXC)) airo_handle_tx(ai, status); if ( status & ~STATUS_INTS & ~IGNORE_INTS ) { airo_print_warn(ai->dev->name, "Got weird status %x", status & ~STATUS_INTS & ~IGNORE_INTS ); } } if (savedInterrupts) OUT4500(ai, EVINTEN, savedInterrupts); return IRQ_RETVAL(handled); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,161
static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { int rc = 0; struct airo_info *ai = dev->ml_priv; if (ai->power.event) return 0; switch (cmd) { #ifdef CISCO_EXT case AIROIDIFC: #ifdef AIROOLDIDIFC case AIROOLDIDIFC: #endif { int val = AIROMAGIC; aironet_ioctl com; if (copy_from_user(&com,rq->ifr_data,sizeof(com))) rc = -EFAULT; else if (copy_to_user(com.data,(char *)&val,sizeof(val))) rc = -EFAULT; } break; case AIROIOCTL: #ifdef AIROOLDIOCTL case AIROOLDIOCTL: #endif /* Get the command struct and hand it off for evaluation by * the proper subfunction */ { aironet_ioctl com; if (copy_from_user(&com,rq->ifr_data,sizeof(com))) { rc = -EFAULT; break; } /* Separate R/W functions bracket legality here */ if ( com.command == AIRORSWVERSION ) { if (copy_to_user(com.data, swversion, sizeof(swversion))) rc = -EFAULT; else rc = 0; } else if ( com.command <= AIRORRID) rc = readrids(dev,&com); else if ( com.command >= AIROPCAP && com.command <= (AIROPLEAPUSR+2) ) rc = writerids(dev,&com); else if ( com.command >= AIROFLSHRST && com.command <= AIRORESTART ) rc = flashcard(dev,&com); else rc = -EINVAL; /* Bad command in ioctl */ } break; #endif /* CISCO_EXT */ default: rc = -EOPNOTSUPP; } return rc; }
DoS
0
static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { int rc = 0; struct airo_info *ai = dev->ml_priv; if (ai->power.event) return 0; switch (cmd) { #ifdef CISCO_EXT case AIROIDIFC: #ifdef AIROOLDIDIFC case AIROOLDIDIFC: #endif { int val = AIROMAGIC; aironet_ioctl com; if (copy_from_user(&com,rq->ifr_data,sizeof(com))) rc = -EFAULT; else if (copy_to_user(com.data,(char *)&val,sizeof(val))) rc = -EFAULT; } break; case AIROIOCTL: #ifdef AIROOLDIOCTL case AIROOLDIOCTL: #endif /* Get the command struct and hand it off for evaluation by * the proper subfunction */ { aironet_ioctl com; if (copy_from_user(&com,rq->ifr_data,sizeof(com))) { rc = -EFAULT; break; } /* Separate R/W functions bracket legality here */ if ( com.command == AIRORSWVERSION ) { if (copy_to_user(com.data, swversion, sizeof(swversion))) rc = -EFAULT; else rc = 0; } else if ( com.command <= AIRORRID) rc = readrids(dev,&com); else if ( com.command >= AIROPCAP && com.command <= (AIROPLEAPUSR+2) ) rc = writerids(dev,&com); else if ( com.command >= AIROFLSHRST && com.command <= AIRORESTART ) rc = flashcard(dev,&com); else rc = -EINVAL; /* Bad command in ioctl */ } break; #endif /* CISCO_EXT */ default: rc = -EOPNOTSUPP; } return rc; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,162
static int airo_networks_allocate(struct airo_info *ai) { if (ai->networks) return 0; ai->networks = kcalloc(AIRO_MAX_NETWORK_COUNT, sizeof(BSSListElement), GFP_KERNEL); if (!ai->networks) { airo_print_warn("", "Out of memory allocating beacons"); return -ENOMEM; } return 0; }
DoS
0
static int airo_networks_allocate(struct airo_info *ai) { if (ai->networks) return 0; ai->networks = kcalloc(AIRO_MAX_NETWORK_COUNT, sizeof(BSSListElement), GFP_KERNEL); if (!ai->networks) { airo_print_warn("", "Out of memory allocating beacons"); return -ENOMEM; } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,163
static void airo_networks_free(struct airo_info *ai) { kfree(ai->networks); ai->networks = NULL; }
DoS
0
static void airo_networks_free(struct airo_info *ai) { kfree(ai->networks); ai->networks = NULL; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,164
static void airo_networks_initialize(struct airo_info *ai) { int i; INIT_LIST_HEAD(&ai->network_free_list); INIT_LIST_HEAD(&ai->network_list); for (i = 0; i < AIRO_MAX_NETWORK_COUNT; i++) list_add_tail(&ai->networks[i].list, &ai->network_free_list); }
DoS
0
static void airo_networks_initialize(struct airo_info *ai) { int i; INIT_LIST_HEAD(&ai->network_free_list); INIT_LIST_HEAD(&ai->network_list); for (i = 0; i < AIRO_MAX_NETWORK_COUNT; i++) list_add_tail(&ai->networks[i].list, &ai->network_free_list); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,165
static int airo_open(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; int rc = 0; if (test_bit(FLAG_FLASHING, &ai->flags)) return -EIO; /* Make sure the card is configured. * Wireless Extensions may postpone config changes until the card * is open (to pipeline changes and speed-up card setup). If * those changes are not yet committed, do it now - Jean II */ if (test_bit(FLAG_COMMIT, &ai->flags)) { disable_MAC(ai, 1); writeConfigRid(ai, 1); } if (ai->wifidev != dev) { clear_bit(JOB_DIE, &ai->jobs); ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name); if (IS_ERR(ai->airo_thread_task)) return (int)PTR_ERR(ai->airo_thread_task); rc = request_irq(dev->irq, airo_interrupt, IRQF_SHARED, dev->name, dev); if (rc) { airo_print_err(dev->name, "register interrupt %d failed, rc %d", dev->irq, rc); set_bit(JOB_DIE, &ai->jobs); kthread_stop(ai->airo_thread_task); return rc; } /* Power on the MAC controller (which may have been disabled) */ clear_bit(FLAG_RADIO_DOWN, &ai->flags); enable_interrupts(ai); try_auto_wep(ai); } enable_MAC(ai, 1); netif_start_queue(dev); return 0; }
DoS
0
static int airo_open(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; int rc = 0; if (test_bit(FLAG_FLASHING, &ai->flags)) return -EIO; /* Make sure the card is configured. * Wireless Extensions may postpone config changes until the card * is open (to pipeline changes and speed-up card setup). If * those changes are not yet committed, do it now - Jean II */ if (test_bit(FLAG_COMMIT, &ai->flags)) { disable_MAC(ai, 1); writeConfigRid(ai, 1); } if (ai->wifidev != dev) { clear_bit(JOB_DIE, &ai->jobs); ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name); if (IS_ERR(ai->airo_thread_task)) return (int)PTR_ERR(ai->airo_thread_task); rc = request_irq(dev->irq, airo_interrupt, IRQF_SHARED, dev->name, dev); if (rc) { airo_print_err(dev->name, "register interrupt %d failed, rc %d", dev->irq, rc); set_bit(JOB_DIE, &ai->jobs); kthread_stop(ai->airo_thread_task); return rc; } /* Power on the MAC controller (which may have been disabled) */ clear_bit(FLAG_RADIO_DOWN, &ai->flags); enable_interrupts(ai); try_auto_wep(ai); } enable_MAC(ai, 1); netif_start_queue(dev); return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,166
static int __devinit airo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pent) { struct net_device *dev; if (pci_enable_device(pdev)) return -ENODEV; pci_set_master(pdev); if (pdev->device == 0x5000 || pdev->device == 0xa504) dev = _init_airo_card(pdev->irq, pdev->resource[0].start, 0, pdev, &pdev->dev); else dev = _init_airo_card(pdev->irq, pdev->resource[2].start, 0, pdev, &pdev->dev); if (!dev) { pci_disable_device(pdev); return -ENODEV; } pci_set_drvdata(pdev, dev); return 0; }
DoS
0
static int __devinit airo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pent) { struct net_device *dev; if (pci_enable_device(pdev)) return -ENODEV; pci_set_master(pdev); if (pdev->device == 0x5000 || pdev->device == 0xa504) dev = _init_airo_card(pdev->irq, pdev->resource[0].start, 0, pdev, &pdev->dev); else dev = _init_airo_card(pdev->irq, pdev->resource[2].start, 0, pdev, &pdev->dev); if (!dev) { pci_disable_device(pdev); return -ENODEV; } pci_set_drvdata(pdev, dev); return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,167
static void __devexit airo_pci_remove(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); airo_print_info(dev->name, "Unregistering..."); stop_airo_card(dev, 1); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); }
DoS
0
static void __devexit airo_pci_remove(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); airo_print_info(dev->name, "Unregistering..."); stop_airo_card(dev, 1); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,168
static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state) { struct net_device *dev = pci_get_drvdata(pdev); struct airo_info *ai = dev->ml_priv; Cmd cmd; Resp rsp; if (!ai->APList) ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL); if (!ai->APList) return -ENOMEM; if (!ai->SSID) ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL); if (!ai->SSID) return -ENOMEM; readAPListRid(ai, ai->APList); readSsidRid(ai, ai->SSID); memset(&cmd, 0, sizeof(cmd)); /* the lock will be released at the end of the resume callback */ if (down_interruptible(&ai->sem)) return -EAGAIN; disable_MAC(ai, 0); netif_device_detach(dev); ai->power = state; cmd.cmd = HOSTSLEEP; issuecommand(ai, &cmd, &rsp); pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); pci_save_state(pdev); pci_set_power_state(pdev, pci_choose_state(pdev, state)); return 0; }
DoS
0
static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state) { struct net_device *dev = pci_get_drvdata(pdev); struct airo_info *ai = dev->ml_priv; Cmd cmd; Resp rsp; if (!ai->APList) ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL); if (!ai->APList) return -ENOMEM; if (!ai->SSID) ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL); if (!ai->SSID) return -ENOMEM; readAPListRid(ai, ai->APList); readSsidRid(ai, ai->SSID); memset(&cmd, 0, sizeof(cmd)); /* the lock will be released at the end of the resume callback */ if (down_interruptible(&ai->sem)) return -EAGAIN; disable_MAC(ai, 0); netif_device_detach(dev); ai->power = state; cmd.cmd = HOSTSLEEP; issuecommand(ai, &cmd, &rsp); pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); pci_save_state(pdev); pci_set_power_state(pdev, pci_choose_state(pdev, state)); return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,169
static void airo_print_status(const char *devname, u16 status) { u8 reason = status & 0xFF; switch (status & 0xFF00) { case STAT_NOBEACON: switch (status) { case STAT_NOBEACON: airo_print_dbg(devname, "link lost (missed beacons)"); break; case STAT_MAXRETRIES: case STAT_MAXARL: airo_print_dbg(devname, "link lost (max retries)"); break; case STAT_FORCELOSS: airo_print_dbg(devname, "link lost (local choice)"); break; case STAT_TSFSYNC: airo_print_dbg(devname, "link lost (TSF sync lost)"); break; default: airo_print_dbg(devname, "unknow status %x\n", status); break; } break; case STAT_DEAUTH: airo_print_dbg(devname, "deauthenticated (reason: %d)", reason); break; case STAT_DISASSOC: airo_print_dbg(devname, "disassociated (reason: %d)", reason); break; case STAT_ASSOC_FAIL: airo_print_dbg(devname, "association failed (reason: %d)", reason); break; case STAT_AUTH_FAIL: airo_print_dbg(devname, "authentication failed (reason: %d)", reason); break; case STAT_ASSOC: case STAT_REASSOC: break; default: airo_print_dbg(devname, "unknow status %x\n", status); break; } }
DoS
0
static void airo_print_status(const char *devname, u16 status) { u8 reason = status & 0xFF; switch (status & 0xFF00) { case STAT_NOBEACON: switch (status) { case STAT_NOBEACON: airo_print_dbg(devname, "link lost (missed beacons)"); break; case STAT_MAXRETRIES: case STAT_MAXARL: airo_print_dbg(devname, "link lost (max retries)"); break; case STAT_FORCELOSS: airo_print_dbg(devname, "link lost (local choice)"); break; case STAT_TSFSYNC: airo_print_dbg(devname, "link lost (TSF sync lost)"); break; default: airo_print_dbg(devname, "unknow status %x\n", status); break; } break; case STAT_DEAUTH: airo_print_dbg(devname, "deauthenticated (reason: %d)", reason); break; case STAT_DISASSOC: airo_print_dbg(devname, "disassociated (reason: %d)", reason); break; case STAT_ASSOC_FAIL: airo_print_dbg(devname, "association failed (reason: %d)", reason); break; case STAT_AUTH_FAIL: airo_print_dbg(devname, "authentication failed (reason: %d)", reason); break; case STAT_ASSOC: case STAT_REASSOC: break; default: airo_print_dbg(devname, "unknow status %x\n", status); break; } }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,170
static void airo_process_scan_results (struct airo_info *ai) { union iwreq_data wrqu; BSSListRid bss; int rc; BSSListElement * loop_net; BSSListElement * tmp_net; /* Blow away current list of scan results */ list_for_each_entry_safe (loop_net, tmp_net, &ai->network_list, list) { list_move_tail (&loop_net->list, &ai->network_free_list); /* Don't blow away ->list, just BSS data */ memset (loop_net, 0, sizeof (loop_net->bss)); } /* Try to read the first entry of the scan result */ rc = PC4500_readrid(ai, ai->bssListFirst, &bss, ai->bssListRidLen, 0); if((rc) || (bss.index == cpu_to_le16(0xffff))) { /* No scan results */ goto out; } /* Read and parse all entries */ tmp_net = NULL; while((!rc) && (bss.index != cpu_to_le16(0xffff))) { /* Grab a network off the free list */ if (!list_empty(&ai->network_free_list)) { tmp_net = list_entry(ai->network_free_list.next, BSSListElement, list); list_del(ai->network_free_list.next); } if (tmp_net != NULL) { memcpy(tmp_net, &bss, sizeof(tmp_net->bss)); list_add_tail(&tmp_net->list, &ai->network_list); tmp_net = NULL; } /* Read next entry */ rc = PC4500_readrid(ai, ai->bssListNext, &bss, ai->bssListRidLen, 0); } out: ai->scan_timeout = 0; clear_bit(JOB_SCAN_RESULTS, &ai->jobs); up(&ai->sem); /* Send an empty event to user space. * We don't send the received data on * the event because it would require * us to do complex transcoding, and * we want to minimise the work done in * the irq handler. Use a request to * extract the data - Jean II */ wrqu.data.length = 0; wrqu.data.flags = 0; wireless_send_event(ai->dev, SIOCGIWSCAN, &wrqu, NULL); }
DoS
0
static void airo_process_scan_results (struct airo_info *ai) { union iwreq_data wrqu; BSSListRid bss; int rc; BSSListElement * loop_net; BSSListElement * tmp_net; /* Blow away current list of scan results */ list_for_each_entry_safe (loop_net, tmp_net, &ai->network_list, list) { list_move_tail (&loop_net->list, &ai->network_free_list); /* Don't blow away ->list, just BSS data */ memset (loop_net, 0, sizeof (loop_net->bss)); } /* Try to read the first entry of the scan result */ rc = PC4500_readrid(ai, ai->bssListFirst, &bss, ai->bssListRidLen, 0); if((rc) || (bss.index == cpu_to_le16(0xffff))) { /* No scan results */ goto out; } /* Read and parse all entries */ tmp_net = NULL; while((!rc) && (bss.index != cpu_to_le16(0xffff))) { /* Grab a network off the free list */ if (!list_empty(&ai->network_free_list)) { tmp_net = list_entry(ai->network_free_list.next, BSSListElement, list); list_del(ai->network_free_list.next); } if (tmp_net != NULL) { memcpy(tmp_net, &bss, sizeof(tmp_net->bss)); list_add_tail(&tmp_net->list, &ai->network_list); tmp_net = NULL; } /* Read next entry */ rc = PC4500_readrid(ai, ai->bssListNext, &bss, ai->bssListRidLen, 0); } out: ai->scan_timeout = 0; clear_bit(JOB_SCAN_RESULTS, &ai->jobs); up(&ai->sem); /* Send an empty event to user space. * We don't send the received data on * the event because it would require * us to do complex transcoding, and * we want to minimise the work done in * the irq handler. Use a request to * extract the data - Jean II */ wrqu.data.length = 0; wrqu.data.flags = 0; wireless_send_event(ai->dev, SIOCGIWSCAN, &wrqu, NULL); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,171
static void airo_read_wireless_stats(struct airo_info *local) { StatusRid status_rid; StatsRid stats_rid; CapabilityRid cap_rid; __le32 *vals = stats_rid.vals; /* Get stats out of the card */ clear_bit(JOB_WSTATS, &local->jobs); if (local->power.event) { up(&local->sem); return; } readCapabilityRid(local, &cap_rid, 0); readStatusRid(local, &status_rid, 0); readStatsRid(local, &stats_rid, RID_STATS, 0); up(&local->sem); /* The status */ local->wstats.status = le16_to_cpu(status_rid.mode); /* Signal quality and co */ if (local->rssi) { local->wstats.qual.level = airo_rssi_to_dbm(local->rssi, le16_to_cpu(status_rid.sigQuality)); /* normalizedSignalStrength appears to be a percentage */ local->wstats.qual.qual = le16_to_cpu(status_rid.normalizedSignalStrength); } else { local->wstats.qual.level = (le16_to_cpu(status_rid.normalizedSignalStrength) + 321) / 2; local->wstats.qual.qual = airo_get_quality(&status_rid, &cap_rid); } if (le16_to_cpu(status_rid.len) >= 124) { local->wstats.qual.noise = 0x100 - status_rid.noisedBm; local->wstats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; } else { local->wstats.qual.noise = 0; local->wstats.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_INVALID | IW_QUAL_DBM; } /* Packets discarded in the wireless adapter due to wireless * specific problems */ local->wstats.discard.nwid = le32_to_cpu(vals[56]) + le32_to_cpu(vals[57]) + le32_to_cpu(vals[58]); /* SSID Mismatch */ local->wstats.discard.code = le32_to_cpu(vals[6]);/* RxWepErr */ local->wstats.discard.fragment = le32_to_cpu(vals[30]); local->wstats.discard.retries = le32_to_cpu(vals[10]); local->wstats.discard.misc = le32_to_cpu(vals[1]) + le32_to_cpu(vals[32]); local->wstats.miss.beacon = le32_to_cpu(vals[34]); }
DoS
0
static void airo_read_wireless_stats(struct airo_info *local) { StatusRid status_rid; StatsRid stats_rid; CapabilityRid cap_rid; __le32 *vals = stats_rid.vals; /* Get stats out of the card */ clear_bit(JOB_WSTATS, &local->jobs); if (local->power.event) { up(&local->sem); return; } readCapabilityRid(local, &cap_rid, 0); readStatusRid(local, &status_rid, 0); readStatsRid(local, &stats_rid, RID_STATS, 0); up(&local->sem); /* The status */ local->wstats.status = le16_to_cpu(status_rid.mode); /* Signal quality and co */ if (local->rssi) { local->wstats.qual.level = airo_rssi_to_dbm(local->rssi, le16_to_cpu(status_rid.sigQuality)); /* normalizedSignalStrength appears to be a percentage */ local->wstats.qual.qual = le16_to_cpu(status_rid.normalizedSignalStrength); } else { local->wstats.qual.level = (le16_to_cpu(status_rid.normalizedSignalStrength) + 321) / 2; local->wstats.qual.qual = airo_get_quality(&status_rid, &cap_rid); } if (le16_to_cpu(status_rid.len) >= 124) { local->wstats.qual.noise = 0x100 - status_rid.noisedBm; local->wstats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; } else { local->wstats.qual.noise = 0; local->wstats.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_INVALID | IW_QUAL_DBM; } /* Packets discarded in the wireless adapter due to wireless * specific problems */ local->wstats.discard.nwid = le32_to_cpu(vals[56]) + le32_to_cpu(vals[57]) + le32_to_cpu(vals[58]); /* SSID Mismatch */ local->wstats.discard.code = le32_to_cpu(vals[6]);/* RxWepErr */ local->wstats.discard.fragment = le32_to_cpu(vals[30]); local->wstats.discard.retries = le32_to_cpu(vals[10]); local->wstats.discard.misc = le32_to_cpu(vals[1]) + le32_to_cpu(vals[32]); local->wstats.miss.beacon = le32_to_cpu(vals[34]); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,172
static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi) { if (!rssi_rid) return 0; return (0x100 - rssi_rid[rssi].rssidBm); }
DoS
0
static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi) { if (!rssi_rid) return 0; return (0x100 - rssi_rid[rssi].rssidBm); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,173
static int airo_set_auth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct airo_info *local = dev->ml_priv; struct iw_param *param = &wrqu->param; __le16 currentAuthType = local->config.authType; switch (param->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_GROUP: case IW_AUTH_KEY_MGMT: case IW_AUTH_RX_UNENCRYPTED_EAPOL: case IW_AUTH_PRIVACY_INVOKED: /* * airo does not use these parameters */ break; case IW_AUTH_DROP_UNENCRYPTED: if (param->value) { /* Only change auth type if unencrypted */ if (currentAuthType == AUTH_OPEN) local->config.authType = AUTH_ENCRYPT; } else { local->config.authType = AUTH_OPEN; } /* Commit the changes to flags if needed */ if (local->config.authType != currentAuthType) set_bit (FLAG_COMMIT, &local->flags); break; case IW_AUTH_80211_AUTH_ALG: { /* FIXME: What about AUTH_OPEN? This API seems to * disallow setting our auth to AUTH_OPEN. */ if (param->value & IW_AUTH_ALG_SHARED_KEY) { local->config.authType = AUTH_SHAREDKEY; } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { local->config.authType = AUTH_ENCRYPT; } else return -EINVAL; /* Commit the changes to flags if needed */ if (local->config.authType != currentAuthType) set_bit (FLAG_COMMIT, &local->flags); break; } case IW_AUTH_WPA_ENABLED: /* Silently accept disable of WPA */ if (param->value > 0) return -EOPNOTSUPP; break; default: return -EOPNOTSUPP; } return -EINPROGRESS; }
DoS
0
static int airo_set_auth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct airo_info *local = dev->ml_priv; struct iw_param *param = &wrqu->param; __le16 currentAuthType = local->config.authType; switch (param->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_GROUP: case IW_AUTH_KEY_MGMT: case IW_AUTH_RX_UNENCRYPTED_EAPOL: case IW_AUTH_PRIVACY_INVOKED: /* * airo does not use these parameters */ break; case IW_AUTH_DROP_UNENCRYPTED: if (param->value) { /* Only change auth type if unencrypted */ if (currentAuthType == AUTH_OPEN) local->config.authType = AUTH_ENCRYPT; } else { local->config.authType = AUTH_OPEN; } /* Commit the changes to flags if needed */ if (local->config.authType != currentAuthType) set_bit (FLAG_COMMIT, &local->flags); break; case IW_AUTH_80211_AUTH_ALG: { /* FIXME: What about AUTH_OPEN? This API seems to * disallow setting our auth to AUTH_OPEN. */ if (param->value & IW_AUTH_ALG_SHARED_KEY) { local->config.authType = AUTH_SHAREDKEY; } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { local->config.authType = AUTH_ENCRYPT; } else return -EINVAL; /* Commit the changes to flags if needed */ if (local->config.authType != currentAuthType) set_bit (FLAG_COMMIT, &local->flags); break; } case IW_AUTH_WPA_ENABLED: /* Silently accept disable of WPA */ if (param->value > 0) return -EOPNOTSUPP; break; default: return -EOPNOTSUPP; } return -EINPROGRESS; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,174
static int airo_set_encode(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; int perm = (dwrq->flags & IW_ENCODE_TEMP ? 0 : 1); __le16 currentAuthType = local->config.authType; int rc = 0; if (!local->wep_capable) return -EOPNOTSUPP; readConfigRid(local, 1); /* Basic checking: do we have a key to set ? * Note : with the new API, it's impossible to get a NULL pointer. * Therefore, we need to check a key size == 0 instead. * New version of iwconfig properly set the IW_ENCODE_NOKEY flag * when no key is present (only change flags), but older versions * don't do it. - Jean II */ if (dwrq->length > 0) { wep_key_t key; int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; int current_index; /* Check the size of the key */ if (dwrq->length > MAX_KEY_SIZE) { return -EINVAL; } current_index = get_wep_tx_idx(local); if (current_index < 0) current_index = 0; /* Check the index (none -> use current) */ if (!valid_index(local, index)) index = current_index; /* Set the length */ if (dwrq->length > MIN_KEY_SIZE) key.len = MAX_KEY_SIZE; else key.len = MIN_KEY_SIZE; /* Check if the key is not marked as invalid */ if(!(dwrq->flags & IW_ENCODE_NOKEY)) { /* Cleanup */ memset(key.key, 0, MAX_KEY_SIZE); /* Copy the key in the driver */ memcpy(key.key, extra, dwrq->length); /* Send the key to the card */ rc = set_wep_key(local, index, key.key, key.len, perm, 1); if (rc < 0) { airo_print_err(local->dev->name, "failed to set" " WEP key at index %d: %d.", index, rc); return rc; } } /* WE specify that if a valid key is set, encryption * should be enabled (user may turn it off later) * This is also how "iwconfig ethX key on" works */ if((index == current_index) && (key.len > 0) && (local->config.authType == AUTH_OPEN)) { local->config.authType = AUTH_ENCRYPT; } } else { /* Do we want to just set the transmit key index ? */ int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; if (valid_index(local, index)) { rc = set_wep_tx_idx(local, index, perm, 1); if (rc < 0) { airo_print_err(local->dev->name, "failed to set" " WEP transmit index to %d: %d.", index, rc); return rc; } } else { /* Don't complain if only change the mode */ if (!(dwrq->flags & IW_ENCODE_MODE)) return -EINVAL; } } /* Read the flags */ if(dwrq->flags & IW_ENCODE_DISABLED) local->config.authType = AUTH_OPEN; // disable encryption if(dwrq->flags & IW_ENCODE_RESTRICTED) local->config.authType = AUTH_SHAREDKEY; // Only Both if(dwrq->flags & IW_ENCODE_OPEN) local->config.authType = AUTH_ENCRYPT; // Only Wep /* Commit the changes to flags if needed */ if (local->config.authType != currentAuthType) set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
DoS
0
static int airo_set_encode(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; int perm = (dwrq->flags & IW_ENCODE_TEMP ? 0 : 1); __le16 currentAuthType = local->config.authType; int rc = 0; if (!local->wep_capable) return -EOPNOTSUPP; readConfigRid(local, 1); /* Basic checking: do we have a key to set ? * Note : with the new API, it's impossible to get a NULL pointer. * Therefore, we need to check a key size == 0 instead. * New version of iwconfig properly set the IW_ENCODE_NOKEY flag * when no key is present (only change flags), but older versions * don't do it. - Jean II */ if (dwrq->length > 0) { wep_key_t key; int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; int current_index; /* Check the size of the key */ if (dwrq->length > MAX_KEY_SIZE) { return -EINVAL; } current_index = get_wep_tx_idx(local); if (current_index < 0) current_index = 0; /* Check the index (none -> use current) */ if (!valid_index(local, index)) index = current_index; /* Set the length */ if (dwrq->length > MIN_KEY_SIZE) key.len = MAX_KEY_SIZE; else key.len = MIN_KEY_SIZE; /* Check if the key is not marked as invalid */ if(!(dwrq->flags & IW_ENCODE_NOKEY)) { /* Cleanup */ memset(key.key, 0, MAX_KEY_SIZE); /* Copy the key in the driver */ memcpy(key.key, extra, dwrq->length); /* Send the key to the card */ rc = set_wep_key(local, index, key.key, key.len, perm, 1); if (rc < 0) { airo_print_err(local->dev->name, "failed to set" " WEP key at index %d: %d.", index, rc); return rc; } } /* WE specify that if a valid key is set, encryption * should be enabled (user may turn it off later) * This is also how "iwconfig ethX key on" works */ if((index == current_index) && (key.len > 0) && (local->config.authType == AUTH_OPEN)) { local->config.authType = AUTH_ENCRYPT; } } else { /* Do we want to just set the transmit key index ? */ int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; if (valid_index(local, index)) { rc = set_wep_tx_idx(local, index, perm, 1); if (rc < 0) { airo_print_err(local->dev->name, "failed to set" " WEP transmit index to %d: %d.", index, rc); return rc; } } else { /* Don't complain if only change the mode */ if (!(dwrq->flags & IW_ENCODE_MODE)) return -EINVAL; } } /* Read the flags */ if(dwrq->flags & IW_ENCODE_DISABLED) local->config.authType = AUTH_OPEN; // disable encryption if(dwrq->flags & IW_ENCODE_RESTRICTED) local->config.authType = AUTH_SHAREDKEY; // Only Both if(dwrq->flags & IW_ENCODE_OPEN) local->config.authType = AUTH_ENCRYPT; // Only Wep /* Commit the changes to flags if needed */ if (local->config.authType != currentAuthType) set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,175
static int airo_set_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; SsidRid SSID_rid; /* SSIDs */ /* Reload the list of current SSID */ readSsidRid(local, &SSID_rid); /* Check if we asked for `any' */ if (dwrq->flags == 0) { /* Just send an empty SSID list */ memset(&SSID_rid, 0, sizeof(SSID_rid)); } else { unsigned index = (dwrq->flags & IW_ENCODE_INDEX) - 1; /* Check the size of the string */ if (dwrq->length > IW_ESSID_MAX_SIZE) return -E2BIG ; /* Check if index is valid */ if (index >= ARRAY_SIZE(SSID_rid.ssids)) return -EINVAL; /* Set the SSID */ memset(SSID_rid.ssids[index].ssid, 0, sizeof(SSID_rid.ssids[index].ssid)); memcpy(SSID_rid.ssids[index].ssid, extra, dwrq->length); SSID_rid.ssids[index].len = cpu_to_le16(dwrq->length); } SSID_rid.len = cpu_to_le16(sizeof(SSID_rid)); /* Write it to the card */ disable_MAC(local, 1); writeSsidRid(local, &SSID_rid, 1); enable_MAC(local, 1); return 0; }
DoS
0
static int airo_set_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; SsidRid SSID_rid; /* SSIDs */ /* Reload the list of current SSID */ readSsidRid(local, &SSID_rid); /* Check if we asked for `any' */ if (dwrq->flags == 0) { /* Just send an empty SSID list */ memset(&SSID_rid, 0, sizeof(SSID_rid)); } else { unsigned index = (dwrq->flags & IW_ENCODE_INDEX) - 1; /* Check the size of the string */ if (dwrq->length > IW_ESSID_MAX_SIZE) return -E2BIG ; /* Check if index is valid */ if (index >= ARRAY_SIZE(SSID_rid.ssids)) return -EINVAL; /* Set the SSID */ memset(SSID_rid.ssids[index].ssid, 0, sizeof(SSID_rid.ssids[index].ssid)); memcpy(SSID_rid.ssids[index].ssid, extra, dwrq->length); SSID_rid.ssids[index].len = cpu_to_le16(dwrq->length); } SSID_rid.len = cpu_to_le16(sizeof(SSID_rid)); /* Write it to the card */ disable_MAC(local, 1); writeSsidRid(local, &SSID_rid, 1); enable_MAC(local, 1); return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,176
static int airo_set_frag(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; int fthr = vwrq->value; if(vwrq->disabled) fthr = AIRO_DEF_MTU; if((fthr < 256) || (fthr > AIRO_DEF_MTU)) { return -EINVAL; } fthr &= ~0x1; /* Get an even value - is it really needed ??? */ readConfigRid(local, 1); local->config.fragThresh = cpu_to_le16(fthr); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
DoS
0
static int airo_set_frag(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; int fthr = vwrq->value; if(vwrq->disabled) fthr = AIRO_DEF_MTU; if((fthr < 256) || (fthr > AIRO_DEF_MTU)) { return -EINVAL; } fthr &= ~0x1; /* Get an even value - is it really needed ??? */ readConfigRid(local, 1); local->config.fragThresh = cpu_to_le16(fthr); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,177
static int airo_set_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { struct airo_info *local = dev->ml_priv; int rc = -EINPROGRESS; /* Call commit handler */ /* If setting by frequency, convert to a channel */ if(fwrq->e == 1) { int f = fwrq->m / 100000; /* Hack to fall through... */ fwrq->e = 0; fwrq->m = ieee80211_freq_to_dsss_chan(f); } /* Setting by channel number */ if((fwrq->m > 1000) || (fwrq->e > 0)) rc = -EOPNOTSUPP; else { int channel = fwrq->m; /* We should do a better check than that, * based on the card capability !!! */ if((channel < 1) || (channel > 14)) { airo_print_dbg(dev->name, "New channel value of %d is invalid!", fwrq->m); rc = -EINVAL; } else { readConfigRid(local, 1); /* Yes ! We can set it !!! */ local->config.channelSet = cpu_to_le16(channel); set_bit (FLAG_COMMIT, &local->flags); } } return rc; }
DoS
0
static int airo_set_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { struct airo_info *local = dev->ml_priv; int rc = -EINPROGRESS; /* Call commit handler */ /* If setting by frequency, convert to a channel */ if(fwrq->e == 1) { int f = fwrq->m / 100000; /* Hack to fall through... */ fwrq->e = 0; fwrq->m = ieee80211_freq_to_dsss_chan(f); } /* Setting by channel number */ if((fwrq->m > 1000) || (fwrq->e > 0)) rc = -EOPNOTSUPP; else { int channel = fwrq->m; /* We should do a better check than that, * based on the card capability !!! */ if((channel < 1) || (channel > 14)) { airo_print_dbg(dev->name, "New channel value of %d is invalid!", fwrq->m); rc = -EINVAL; } else { readConfigRid(local, 1); /* Yes ! We can set it !!! */ local->config.channelSet = cpu_to_le16(channel); set_bit (FLAG_COMMIT, &local->flags); } } return rc; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,178
static int airo_set_mode(struct net_device *dev, struct iw_request_info *info, __u32 *uwrq, char *extra) { struct airo_info *local = dev->ml_priv; int reset = 0; readConfigRid(local, 1); if (sniffing_mode(local)) reset = 1; switch(*uwrq) { case IW_MODE_ADHOC: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_STA_IBSS; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.scanMode = SCANMODE_ACTIVE; clear_bit (FLAG_802_11, &local->flags); break; case IW_MODE_INFRA: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_STA_ESS; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.scanMode = SCANMODE_ACTIVE; clear_bit (FLAG_802_11, &local->flags); break; case IW_MODE_MASTER: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_AP; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.scanMode = SCANMODE_ACTIVE; clear_bit (FLAG_802_11, &local->flags); break; case IW_MODE_REPEAT: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_AP_RPTR; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.scanMode = SCANMODE_ACTIVE; clear_bit (FLAG_802_11, &local->flags); break; case IW_MODE_MONITOR: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_STA_ESS; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; local->config.scanMode = SCANMODE_PASSIVE; set_bit (FLAG_802_11, &local->flags); break; default: return -EINVAL; } if (reset) set_bit (FLAG_RESET, &local->flags); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
DoS
0
static int airo_set_mode(struct net_device *dev, struct iw_request_info *info, __u32 *uwrq, char *extra) { struct airo_info *local = dev->ml_priv; int reset = 0; readConfigRid(local, 1); if (sniffing_mode(local)) reset = 1; switch(*uwrq) { case IW_MODE_ADHOC: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_STA_IBSS; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.scanMode = SCANMODE_ACTIVE; clear_bit (FLAG_802_11, &local->flags); break; case IW_MODE_INFRA: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_STA_ESS; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.scanMode = SCANMODE_ACTIVE; clear_bit (FLAG_802_11, &local->flags); break; case IW_MODE_MASTER: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_AP; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.scanMode = SCANMODE_ACTIVE; clear_bit (FLAG_802_11, &local->flags); break; case IW_MODE_REPEAT: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_AP_RPTR; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.scanMode = SCANMODE_ACTIVE; clear_bit (FLAG_802_11, &local->flags); break; case IW_MODE_MONITOR: local->config.opmode &= ~MODE_CFG_MASK; local->config.opmode |= MODE_STA_ESS; local->config.rmode &= ~RXMODE_FULL_MASK; local->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; local->config.scanMode = SCANMODE_PASSIVE; set_bit (FLAG_802_11, &local->flags); break; default: return -EINVAL; } if (reset) set_bit (FLAG_RESET, &local->flags); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,179
static void airo_set_multicast_list(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; if ((dev->flags ^ ai->flags) & IFF_PROMISC) { change_bit(FLAG_PROMISC, &ai->flags); if (down_trylock(&ai->sem) != 0) { set_bit(JOB_PROMISC, &ai->jobs); wake_up_interruptible(&ai->thr_wait); } else airo_set_promisc(ai); } if ((dev->flags&IFF_ALLMULTI) || !netdev_mc_empty(dev)) { /* Turn on multicast. (Should be already setup...) */ } }
DoS
0
static void airo_set_multicast_list(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; if ((dev->flags ^ ai->flags) & IFF_PROMISC) { change_bit(FLAG_PROMISC, &ai->flags); if (down_trylock(&ai->sem) != 0) { set_bit(JOB_PROMISC, &ai->jobs); wake_up_interruptible(&ai->thr_wait); } else airo_set_promisc(ai); } if ((dev->flags&IFF_ALLMULTI) || !netdev_mc_empty(dev)) { /* Turn on multicast. (Should be already setup...) */ } }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,180
static int airo_set_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; /* Check the size of the string */ if(dwrq->length > 16) { return -E2BIG; } readConfigRid(local, 1); memset(local->config.nodeName, 0, sizeof(local->config.nodeName)); memcpy(local->config.nodeName, extra, dwrq->length); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
DoS
0
static int airo_set_nick(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *local = dev->ml_priv; /* Check the size of the string */ if(dwrq->length > 16) { return -E2BIG; } readConfigRid(local, 1); memset(local->config.nodeName, 0, sizeof(local->config.nodeName)); memcpy(local->config.nodeName, extra, dwrq->length); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,181
static int airo_set_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); if (vwrq->disabled) { if (sniffing_mode(local)) return -EINVAL; local->config.powerSaveMode = POWERSAVE_CAM; local->config.rmode &= ~RXMODE_MASK; local->config.rmode |= RXMODE_BC_MC_ADDR; set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ } if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { local->config.fastListenDelay = cpu_to_le16((vwrq->value + 500) / 1024); local->config.powerSaveMode = POWERSAVE_PSPCAM; set_bit (FLAG_COMMIT, &local->flags); } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { local->config.fastListenInterval = local->config.listenInterval = cpu_to_le16((vwrq->value + 500) / 1024); local->config.powerSaveMode = POWERSAVE_PSPCAM; set_bit (FLAG_COMMIT, &local->flags); } switch (vwrq->flags & IW_POWER_MODE) { case IW_POWER_UNICAST_R: if (sniffing_mode(local)) return -EINVAL; local->config.rmode &= ~RXMODE_MASK; local->config.rmode |= RXMODE_ADDR; set_bit (FLAG_COMMIT, &local->flags); break; case IW_POWER_ALL_R: if (sniffing_mode(local)) return -EINVAL; local->config.rmode &= ~RXMODE_MASK; local->config.rmode |= RXMODE_BC_MC_ADDR; set_bit (FLAG_COMMIT, &local->flags); case IW_POWER_ON: /* This is broken, fixme ;-) */ break; default: return -EINVAL; } return -EINPROGRESS; /* Call commit handler */ }
DoS
0
static int airo_set_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); if (vwrq->disabled) { if (sniffing_mode(local)) return -EINVAL; local->config.powerSaveMode = POWERSAVE_CAM; local->config.rmode &= ~RXMODE_MASK; local->config.rmode |= RXMODE_BC_MC_ADDR; set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ } if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { local->config.fastListenDelay = cpu_to_le16((vwrq->value + 500) / 1024); local->config.powerSaveMode = POWERSAVE_PSPCAM; set_bit (FLAG_COMMIT, &local->flags); } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { local->config.fastListenInterval = local->config.listenInterval = cpu_to_le16((vwrq->value + 500) / 1024); local->config.powerSaveMode = POWERSAVE_PSPCAM; set_bit (FLAG_COMMIT, &local->flags); } switch (vwrq->flags & IW_POWER_MODE) { case IW_POWER_UNICAST_R: if (sniffing_mode(local)) return -EINVAL; local->config.rmode &= ~RXMODE_MASK; local->config.rmode |= RXMODE_ADDR; set_bit (FLAG_COMMIT, &local->flags); break; case IW_POWER_ALL_R: if (sniffing_mode(local)) return -EINVAL; local->config.rmode &= ~RXMODE_MASK; local->config.rmode |= RXMODE_BC_MC_ADDR; set_bit (FLAG_COMMIT, &local->flags); case IW_POWER_ON: /* This is broken, fixme ;-) */ break; default: return -EINVAL; } return -EINPROGRESS; /* Call commit handler */ }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,182
static int airo_set_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; CapabilityRid cap_rid; /* Card capability info */ u8 brate = 0; int i; /* First : get a valid bit rate value */ readCapabilityRid(local, &cap_rid, 1); /* Which type of value ? */ if((vwrq->value < 8) && (vwrq->value >= 0)) { /* Setting by rate index */ /* Find value in the magic rate table */ brate = cap_rid.supportedRates[vwrq->value]; } else { /* Setting by frequency value */ u8 normvalue = (u8) (vwrq->value/500000); /* Check if rate is valid */ for(i = 0 ; i < 8 ; i++) { if(normvalue == cap_rid.supportedRates[i]) { brate = normvalue; break; } } } /* -1 designed the max rate (mostly auto mode) */ if(vwrq->value == -1) { /* Get the highest available rate */ for(i = 0 ; i < 8 ; i++) { if(cap_rid.supportedRates[i] == 0) break; } if(i != 0) brate = cap_rid.supportedRates[i - 1]; } /* Check that it is valid */ if(brate == 0) { return -EINVAL; } readConfigRid(local, 1); /* Now, check if we want a fixed or auto value */ if(vwrq->fixed == 0) { /* Fill all the rates up to this max rate */ memset(local->config.rates, 0, 8); for(i = 0 ; i < 8 ; i++) { local->config.rates[i] = cap_rid.supportedRates[i]; if(local->config.rates[i] == brate) break; } } else { /* Fixed mode */ /* One rate, fixed */ memset(local->config.rates, 0, 8); local->config.rates[0] = brate; } set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
DoS
0
static int airo_set_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; CapabilityRid cap_rid; /* Card capability info */ u8 brate = 0; int i; /* First : get a valid bit rate value */ readCapabilityRid(local, &cap_rid, 1); /* Which type of value ? */ if((vwrq->value < 8) && (vwrq->value >= 0)) { /* Setting by rate index */ /* Find value in the magic rate table */ brate = cap_rid.supportedRates[vwrq->value]; } else { /* Setting by frequency value */ u8 normvalue = (u8) (vwrq->value/500000); /* Check if rate is valid */ for(i = 0 ; i < 8 ; i++) { if(normvalue == cap_rid.supportedRates[i]) { brate = normvalue; break; } } } /* -1 designed the max rate (mostly auto mode) */ if(vwrq->value == -1) { /* Get the highest available rate */ for(i = 0 ; i < 8 ; i++) { if(cap_rid.supportedRates[i] == 0) break; } if(i != 0) brate = cap_rid.supportedRates[i - 1]; } /* Check that it is valid */ if(brate == 0) { return -EINVAL; } readConfigRid(local, 1); /* Now, check if we want a fixed or auto value */ if(vwrq->fixed == 0) { /* Fill all the rates up to this max rate */ memset(local->config.rates, 0, 8); for(i = 0 ; i < 8 ; i++) { local->config.rates[i] = cap_rid.supportedRates[i]; if(local->config.rates[i] == brate) break; } } else { /* Fixed mode */ /* One rate, fixed */ memset(local->config.rates, 0, 8); local->config.rates[0] = brate; } set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,183
static int airo_set_retry(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; int rc = -EINVAL; if(vwrq->disabled) { return -EINVAL; } readConfigRid(local, 1); if(vwrq->flags & IW_RETRY_LIMIT) { __le16 v = cpu_to_le16(vwrq->value); if(vwrq->flags & IW_RETRY_LONG) local->config.longRetryLimit = v; else if (vwrq->flags & IW_RETRY_SHORT) local->config.shortRetryLimit = v; else { /* No modifier : set both */ local->config.longRetryLimit = v; local->config.shortRetryLimit = v; } set_bit (FLAG_COMMIT, &local->flags); rc = -EINPROGRESS; /* Call commit handler */ } if(vwrq->flags & IW_RETRY_LIFETIME) { local->config.txLifetime = cpu_to_le16(vwrq->value / 1024); set_bit (FLAG_COMMIT, &local->flags); rc = -EINPROGRESS; /* Call commit handler */ } return rc; }
DoS
0
static int airo_set_retry(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; int rc = -EINVAL; if(vwrq->disabled) { return -EINVAL; } readConfigRid(local, 1); if(vwrq->flags & IW_RETRY_LIMIT) { __le16 v = cpu_to_le16(vwrq->value); if(vwrq->flags & IW_RETRY_LONG) local->config.longRetryLimit = v; else if (vwrq->flags & IW_RETRY_SHORT) local->config.shortRetryLimit = v; else { /* No modifier : set both */ local->config.longRetryLimit = v; local->config.shortRetryLimit = v; } set_bit (FLAG_COMMIT, &local->flags); rc = -EINPROGRESS; /* Call commit handler */ } if(vwrq->flags & IW_RETRY_LIFETIME) { local->config.txLifetime = cpu_to_le16(vwrq->value / 1024); set_bit (FLAG_COMMIT, &local->flags); rc = -EINPROGRESS; /* Call commit handler */ } return rc; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,184
static int airo_set_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; int rthr = vwrq->value; if(vwrq->disabled) rthr = AIRO_DEF_MTU; if((rthr < 0) || (rthr > AIRO_DEF_MTU)) { return -EINVAL; } readConfigRid(local, 1); local->config.rtsThres = cpu_to_le16(rthr); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
DoS
0
static int airo_set_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; int rthr = vwrq->value; if(vwrq->disabled) rthr = AIRO_DEF_MTU; if((rthr < 0) || (rthr > AIRO_DEF_MTU)) { return -EINVAL; } readConfigRid(local, 1); local->config.rtsThres = cpu_to_le16(rthr); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,185
static int airo_set_scan(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *ai = dev->ml_priv; Cmd cmd; Resp rsp; int wake = 0; /* Note : you may have realised that, as this is a SET operation, * this is privileged and therefore a normal user can't * perform scanning. * This is not an error, while the device perform scanning, * traffic doesn't flow, so it's a perfect DoS... * Jean II */ if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; if (down_interruptible(&ai->sem)) return -ERESTARTSYS; /* If there's already a scan in progress, don't * trigger another one. */ if (ai->scan_timeout > 0) goto out; /* Initiate a scan command */ ai->scan_timeout = RUN_AT(3*HZ); memset(&cmd, 0, sizeof(cmd)); cmd.cmd=CMD_LISTBSS; issuecommand(ai, &cmd, &rsp); wake = 1; out: up(&ai->sem); if (wake) wake_up_interruptible(&ai->thr_wait); return 0; }
DoS
0
static int airo_set_scan(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { struct airo_info *ai = dev->ml_priv; Cmd cmd; Resp rsp; int wake = 0; /* Note : you may have realised that, as this is a SET operation, * this is privileged and therefore a normal user can't * perform scanning. * This is not an error, while the device perform scanning, * traffic doesn't flow, so it's a perfect DoS... * Jean II */ if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; if (down_interruptible(&ai->sem)) return -ERESTARTSYS; /* If there's already a scan in progress, don't * trigger another one. */ if (ai->scan_timeout > 0) goto out; /* Initiate a scan command */ ai->scan_timeout = RUN_AT(3*HZ); memset(&cmd, 0, sizeof(cmd)); cmd.cmd=CMD_LISTBSS; issuecommand(ai, &cmd, &rsp); wake = 1; out: up(&ai->sem); if (wake) wake_up_interruptible(&ai->thr_wait); return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,186
static int airo_set_sens(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); local->config.rssiThreshold = cpu_to_le16(vwrq->disabled ? RSSI_DEFAULT : vwrq->value); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
DoS
0
static int airo_set_sens(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); local->config.rssiThreshold = cpu_to_le16(vwrq->disabled ? RSSI_DEFAULT : vwrq->value); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,187
static int airo_set_wap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *awrq, char *extra) { struct airo_info *local = dev->ml_priv; Cmd cmd; Resp rsp; APListRid APList_rid; static const u8 any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; static const u8 off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; if (awrq->sa_family != ARPHRD_ETHER) return -EINVAL; else if (!memcmp(any, awrq->sa_data, ETH_ALEN) || !memcmp(off, awrq->sa_data, ETH_ALEN)) { memset(&cmd, 0, sizeof(cmd)); cmd.cmd=CMD_LOSE_SYNC; if (down_interruptible(&local->sem)) return -ERESTARTSYS; issuecommand(local, &cmd, &rsp); up(&local->sem); } else { memset(&APList_rid, 0, sizeof(APList_rid)); APList_rid.len = cpu_to_le16(sizeof(APList_rid)); memcpy(APList_rid.ap[0], awrq->sa_data, ETH_ALEN); disable_MAC(local, 1); writeAPListRid(local, &APList_rid, 1); enable_MAC(local, 1); } return 0; }
DoS
0
static int airo_set_wap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *awrq, char *extra) { struct airo_info *local = dev->ml_priv; Cmd cmd; Resp rsp; APListRid APList_rid; static const u8 any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; static const u8 off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; if (awrq->sa_family != ARPHRD_ETHER) return -EINVAL; else if (!memcmp(any, awrq->sa_data, ETH_ALEN) || !memcmp(off, awrq->sa_data, ETH_ALEN)) { memset(&cmd, 0, sizeof(cmd)); cmd.cmd=CMD_LOSE_SYNC; if (down_interruptible(&local->sem)) return -ERESTARTSYS; issuecommand(local, &cmd, &rsp); up(&local->sem); } else { memset(&APList_rid, 0, sizeof(APList_rid)); APList_rid.len = cpu_to_le16(sizeof(APList_rid)); memcpy(APList_rid.ap[0], awrq->sa_data, ETH_ALEN); disable_MAC(local, 1); writeAPListRid(local, &APList_rid, 1); enable_MAC(local, 1); } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,188
static netdev_tx_t airo_start_xmit(struct sk_buff *skb, struct net_device *dev) { s16 len; int i, j; struct airo_info *priv = dev->ml_priv; u32 *fids = priv->fids; if ( skb == NULL ) { airo_print_err(dev->name, "%s: skb == NULL!", __func__); return NETDEV_TX_OK; } /* Find a vacant FID */ for( i = 0; i < MAX_FIDS / 2 && (fids[i] & 0xffff0000); i++ ); for( j = i + 1; j < MAX_FIDS / 2 && (fids[j] & 0xffff0000); j++ ); if ( j >= MAX_FIDS / 2 ) { netif_stop_queue(dev); if (i == MAX_FIDS / 2) { dev->stats.tx_fifo_errors++; return NETDEV_TX_BUSY; } } /* check min length*/ len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; /* Mark fid as used & save length for later */ fids[i] |= (len << 16); priv->xmit.skb = skb; priv->xmit.fid = i; if (down_trylock(&priv->sem) != 0) { set_bit(FLAG_PENDING_XMIT, &priv->flags); netif_stop_queue(dev); set_bit(JOB_XMIT, &priv->jobs); wake_up_interruptible(&priv->thr_wait); } else airo_end_xmit(dev); return NETDEV_TX_OK; }
DoS
0
static netdev_tx_t airo_start_xmit(struct sk_buff *skb, struct net_device *dev) { s16 len; int i, j; struct airo_info *priv = dev->ml_priv; u32 *fids = priv->fids; if ( skb == NULL ) { airo_print_err(dev->name, "%s: skb == NULL!", __func__); return NETDEV_TX_OK; } /* Find a vacant FID */ for( i = 0; i < MAX_FIDS / 2 && (fids[i] & 0xffff0000); i++ ); for( j = i + 1; j < MAX_FIDS / 2 && (fids[j] & 0xffff0000); j++ ); if ( j >= MAX_FIDS / 2 ) { netif_stop_queue(dev); if (i == MAX_FIDS / 2) { dev->stats.tx_fifo_errors++; return NETDEV_TX_BUSY; } } /* check min length*/ len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; /* Mark fid as used & save length for later */ fids[i] |= (len << 16); priv->xmit.skb = skb; priv->xmit.fid = i; if (down_trylock(&priv->sem) != 0) { set_bit(FLAG_PENDING_XMIT, &priv->flags); netif_stop_queue(dev); set_bit(JOB_XMIT, &priv->jobs); wake_up_interruptible(&priv->thr_wait); } else airo_end_xmit(dev); return NETDEV_TX_OK; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,189
static netdev_tx_t airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) { s16 len; int i, j; struct airo_info *priv = dev->ml_priv; u32 *fids = priv->fids; if (test_bit(FLAG_MPI, &priv->flags)) { /* Not implemented yet for MPI350 */ netif_stop_queue(dev); dev_kfree_skb_any(skb); return NETDEV_TX_OK; } if ( skb == NULL ) { airo_print_err(dev->name, "%s: skb == NULL!", __func__); return NETDEV_TX_OK; } /* Find a vacant FID */ for( i = MAX_FIDS / 2; i < MAX_FIDS && (fids[i] & 0xffff0000); i++ ); for( j = i + 1; j < MAX_FIDS && (fids[j] & 0xffff0000); j++ ); if ( j >= MAX_FIDS ) { netif_stop_queue(dev); if (i == MAX_FIDS) { dev->stats.tx_fifo_errors++; return NETDEV_TX_BUSY; } } /* check min length*/ len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; /* Mark fid as used & save length for later */ fids[i] |= (len << 16); priv->xmit11.skb = skb; priv->xmit11.fid = i; if (down_trylock(&priv->sem) != 0) { set_bit(FLAG_PENDING_XMIT11, &priv->flags); netif_stop_queue(dev); set_bit(JOB_XMIT11, &priv->jobs); wake_up_interruptible(&priv->thr_wait); } else airo_end_xmit11(dev); return NETDEV_TX_OK; }
DoS
0
static netdev_tx_t airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) { s16 len; int i, j; struct airo_info *priv = dev->ml_priv; u32 *fids = priv->fids; if (test_bit(FLAG_MPI, &priv->flags)) { /* Not implemented yet for MPI350 */ netif_stop_queue(dev); dev_kfree_skb_any(skb); return NETDEV_TX_OK; } if ( skb == NULL ) { airo_print_err(dev->name, "%s: skb == NULL!", __func__); return NETDEV_TX_OK; } /* Find a vacant FID */ for( i = MAX_FIDS / 2; i < MAX_FIDS && (fids[i] & 0xffff0000); i++ ); for( j = i + 1; j < MAX_FIDS && (fids[j] & 0xffff0000); j++ ); if ( j >= MAX_FIDS ) { netif_stop_queue(dev); if (i == MAX_FIDS) { dev->stats.tx_fifo_errors++; return NETDEV_TX_BUSY; } } /* check min length*/ len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; /* Mark fid as used & save length for later */ fids[i] |= (len << 16); priv->xmit11.skb = skb; priv->xmit11.fid = i; if (down_trylock(&priv->sem) != 0) { set_bit(FLAG_PENDING_XMIT11, &priv->flags); netif_stop_queue(dev); set_bit(JOB_XMIT11, &priv->jobs); wake_up_interruptible(&priv->thr_wait); } else airo_end_xmit11(dev); return NETDEV_TX_OK; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,190
static int airo_thread(void *data) { struct net_device *dev = data; struct airo_info *ai = dev->ml_priv; int locked; set_freezable(); while(1) { /* make swsusp happy with our thread */ try_to_freeze(); if (test_bit(JOB_DIE, &ai->jobs)) break; if (ai->jobs) { locked = down_interruptible(&ai->sem); } else { wait_queue_t wait; init_waitqueue_entry(&wait, current); add_wait_queue(&ai->thr_wait, &wait); for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (ai->jobs) break; if (ai->expires || ai->scan_timeout) { if (ai->scan_timeout && time_after_eq(jiffies,ai->scan_timeout)){ set_bit(JOB_SCAN_RESULTS, &ai->jobs); break; } else if (ai->expires && time_after_eq(jiffies,ai->expires)){ set_bit(JOB_AUTOWEP, &ai->jobs); break; } if (!kthread_should_stop() && !freezing(current)) { unsigned long wake_at; if (!ai->expires || !ai->scan_timeout) { wake_at = max(ai->expires, ai->scan_timeout); } else { wake_at = min(ai->expires, ai->scan_timeout); } schedule_timeout(wake_at - jiffies); continue; } } else if (!kthread_should_stop() && !freezing(current)) { schedule(); continue; } break; } current->state = TASK_RUNNING; remove_wait_queue(&ai->thr_wait, &wait); locked = 1; } if (locked) continue; if (test_bit(JOB_DIE, &ai->jobs)) { up(&ai->sem); break; } if (ai->power.event || test_bit(FLAG_FLASHING, &ai->flags)) { up(&ai->sem); continue; } if (test_bit(JOB_XMIT, &ai->jobs)) airo_end_xmit(dev); else if (test_bit(JOB_XMIT11, &ai->jobs)) airo_end_xmit11(dev); else if (test_bit(JOB_STATS, &ai->jobs)) airo_read_stats(dev); else if (test_bit(JOB_WSTATS, &ai->jobs)) airo_read_wireless_stats(ai); else if (test_bit(JOB_PROMISC, &ai->jobs)) airo_set_promisc(ai); else if (test_bit(JOB_MIC, &ai->jobs)) micinit(ai); else if (test_bit(JOB_EVENT, &ai->jobs)) airo_send_event(dev); else if (test_bit(JOB_AUTOWEP, &ai->jobs)) timer_func(dev); else if (test_bit(JOB_SCAN_RESULTS, &ai->jobs)) airo_process_scan_results(ai); else /* Shouldn't get here, but we make sure to unlock */ up(&ai->sem); } return 0; }
DoS
0
static int airo_thread(void *data) { struct net_device *dev = data; struct airo_info *ai = dev->ml_priv; int locked; set_freezable(); while(1) { /* make swsusp happy with our thread */ try_to_freeze(); if (test_bit(JOB_DIE, &ai->jobs)) break; if (ai->jobs) { locked = down_interruptible(&ai->sem); } else { wait_queue_t wait; init_waitqueue_entry(&wait, current); add_wait_queue(&ai->thr_wait, &wait); for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (ai->jobs) break; if (ai->expires || ai->scan_timeout) { if (ai->scan_timeout && time_after_eq(jiffies,ai->scan_timeout)){ set_bit(JOB_SCAN_RESULTS, &ai->jobs); break; } else if (ai->expires && time_after_eq(jiffies,ai->expires)){ set_bit(JOB_AUTOWEP, &ai->jobs); break; } if (!kthread_should_stop() && !freezing(current)) { unsigned long wake_at; if (!ai->expires || !ai->scan_timeout) { wake_at = max(ai->expires, ai->scan_timeout); } else { wake_at = min(ai->expires, ai->scan_timeout); } schedule_timeout(wake_at - jiffies); continue; } } else if (!kthread_should_stop() && !freezing(current)) { schedule(); continue; } break; } current->state = TASK_RUNNING; remove_wait_queue(&ai->thr_wait, &wait); locked = 1; } if (locked) continue; if (test_bit(JOB_DIE, &ai->jobs)) { up(&ai->sem); break; } if (ai->power.event || test_bit(FLAG_FLASHING, &ai->flags)) { up(&ai->sem); continue; } if (test_bit(JOB_XMIT, &ai->jobs)) airo_end_xmit(dev); else if (test_bit(JOB_XMIT11, &ai->jobs)) airo_end_xmit11(dev); else if (test_bit(JOB_STATS, &ai->jobs)) airo_read_stats(dev); else if (test_bit(JOB_WSTATS, &ai->jobs)) airo_read_wireless_stats(ai); else if (test_bit(JOB_PROMISC, &ai->jobs)) airo_set_promisc(ai); else if (test_bit(JOB_MIC, &ai->jobs)) micinit(ai); else if (test_bit(JOB_EVENT, &ai->jobs)) airo_send_event(dev); else if (test_bit(JOB_AUTOWEP, &ai->jobs)) timer_func(dev); else if (test_bit(JOB_SCAN_RESULTS, &ai->jobs)) airo_process_scan_results(ai); else /* Shouldn't get here, but we make sure to unlock */ up(&ai->sem); } return 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,191
static u16 aux_setup(struct airo_info *ai, u16 page, u16 offset, u16 *len) { u16 next; OUT4500(ai, AUXPAGE, page); OUT4500(ai, AUXOFF, 0); next = IN4500(ai, AUXDATA); *len = IN4500(ai, AUXDATA)&0xff; if (offset != 4) OUT4500(ai, AUXOFF, offset); return next; }
DoS
0
static u16 aux_setup(struct airo_info *ai, u16 page, u16 offset, u16 *len) { u16 next; OUT4500(ai, AUXPAGE, page); OUT4500(ai, AUXOFF, 0); next = IN4500(ai, AUXDATA); *len = IN4500(ai, AUXDATA)&0xff; if (offset != 4) OUT4500(ai, AUXOFF, offset); return next; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,192
static inline int bap_read(struct airo_info *ai, __le16 *pu16Dst, int bytelen, int whichbap) { return ai->bap_read(ai, pu16Dst, bytelen, whichbap); }
DoS
0
static inline int bap_read(struct airo_info *ai, __le16 *pu16Dst, int bytelen, int whichbap) { return ai->bap_read(ai, pu16Dst, bytelen, whichbap); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,193
static int bap_setup(struct airo_info *ai, u16 rid, u16 offset, int whichbap ) { int timeout = 50; int max_tries = 3; OUT4500(ai, SELECT0+whichbap, rid); OUT4500(ai, OFFSET0+whichbap, offset); while (1) { int status = IN4500(ai, OFFSET0+whichbap); if (status & BAP_BUSY) { /* This isn't really a timeout, but its kinda close */ if (timeout--) { continue; } } else if ( status & BAP_ERR ) { /* invalid rid or offset */ airo_print_err(ai->dev->name, "BAP error %x %d", status, whichbap ); return ERROR; } else if (status & BAP_DONE) { // success return SUCCESS; } if ( !(max_tries--) ) { airo_print_err(ai->dev->name, "BAP setup error too many retries\n"); return ERROR; } OUT4500(ai, SELECT0+whichbap, rid); OUT4500(ai, OFFSET0+whichbap, offset); timeout = 50; } }
DoS
0
static int bap_setup(struct airo_info *ai, u16 rid, u16 offset, int whichbap ) { int timeout = 50; int max_tries = 3; OUT4500(ai, SELECT0+whichbap, rid); OUT4500(ai, OFFSET0+whichbap, offset); while (1) { int status = IN4500(ai, OFFSET0+whichbap); if (status & BAP_BUSY) { /* This isn't really a timeout, but its kinda close */ if (timeout--) { continue; } } else if ( status & BAP_ERR ) { /* invalid rid or offset */ airo_print_err(ai->dev->name, "BAP error %x %d", status, whichbap ); return ERROR; } else if (status & BAP_DONE) { // success return SUCCESS; } if ( !(max_tries--) ) { airo_print_err(ai->dev->name, "BAP setup error too many retries\n"); return ERROR; } OUT4500(ai, SELECT0+whichbap, rid); OUT4500(ai, OFFSET0+whichbap, offset); timeout = 50; } }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,194
static inline void checkThrottle(struct airo_info *ai) { int i; /* Old hardware had a limit on encryption speed */ if (ai->config.authType != AUTH_OPEN && maxencrypt) { for(i=0; i<8; i++) { if (ai->config.rates[i] > maxencrypt) { ai->config.rates[i] = 0; } } } }
DoS
0
static inline void checkThrottle(struct airo_info *ai) { int i; /* Old hardware had a limit on encryption speed */ if (ai->config.authType != AUTH_OPEN && maxencrypt) { for(i=0; i<8; i++) { if (ai->config.rates[i] > maxencrypt) { ai->config.rates[i] = 0; } } } }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,195
static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *eth, u16 payLen) { int i; u32 micSEQ; miccntx *context; u8 digest[4]; mic_error micError = NONE; if (!ai->micstats.enabled) { if (memcmp ((u8*)eth + 14, micsnap, sizeof(micsnap)) == 0) { ai->micstats.rxMICPlummed++; return ERROR; } return SUCCESS; } if (ntohs(mic->typelen) == 0x888E) return SUCCESS; if (memcmp (mic->u.snap, micsnap, sizeof(micsnap)) != 0) { ai->micstats.rxMICPlummed++; return ERROR; } micSEQ = ntohl(mic->seq); //store SEQ as CPU order if ( (micSEQ & 1) == 0 ) { ai->micstats.rxWrongSequence++; return ERROR; } for (i = 0; i < NUM_MODULES; i++) { int mcast = eth->da[0] & 1; context = mcast ? &ai->mod[i].mCtx : &ai->mod[i].uCtx; if (!context->valid) { if (i == 0) micError = NOMICPLUMMED; continue; } if (!mic->typelen) mic->typelen = htons(payLen + sizeof(MICBuffer) - 2); emmh32_init(&context->seed); emmh32_update(&context->seed, eth->da, ETH_ALEN*2); emmh32_update(&context->seed, (u8 *)&mic->typelen, sizeof(mic->typelen)+sizeof(mic->u.snap)); emmh32_update(&context->seed, (u8 *)&mic->seq,sizeof(mic->seq)); emmh32_update(&context->seed, eth->da + ETH_ALEN*2,payLen); emmh32_final(&context->seed, digest); if (memcmp(digest, &mic->mic, 4)) { //Make sure the mics match if (i == 0) micError = INCORRECTMIC; continue; } if (RxSeqValid(ai, context, mcast, micSEQ) == SUCCESS) { ai->micstats.rxSuccess++; return SUCCESS; } if (i == 0) micError = SEQUENCE; } switch (micError) { case NOMICPLUMMED: ai->micstats.rxMICPlummed++; break; case SEQUENCE: ai->micstats.rxWrongSequence++; break; case INCORRECTMIC: ai->micstats.rxIncorrectMIC++; break; case NONE: break; case NOMIC: break; } return ERROR; }
DoS
0
static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *eth, u16 payLen) { int i; u32 micSEQ; miccntx *context; u8 digest[4]; mic_error micError = NONE; if (!ai->micstats.enabled) { if (memcmp ((u8*)eth + 14, micsnap, sizeof(micsnap)) == 0) { ai->micstats.rxMICPlummed++; return ERROR; } return SUCCESS; } if (ntohs(mic->typelen) == 0x888E) return SUCCESS; if (memcmp (mic->u.snap, micsnap, sizeof(micsnap)) != 0) { ai->micstats.rxMICPlummed++; return ERROR; } micSEQ = ntohl(mic->seq); //store SEQ as CPU order if ( (micSEQ & 1) == 0 ) { ai->micstats.rxWrongSequence++; return ERROR; } for (i = 0; i < NUM_MODULES; i++) { int mcast = eth->da[0] & 1; context = mcast ? &ai->mod[i].mCtx : &ai->mod[i].uCtx; if (!context->valid) { if (i == 0) micError = NOMICPLUMMED; continue; } if (!mic->typelen) mic->typelen = htons(payLen + sizeof(MICBuffer) - 2); emmh32_init(&context->seed); emmh32_update(&context->seed, eth->da, ETH_ALEN*2); emmh32_update(&context->seed, (u8 *)&mic->typelen, sizeof(mic->typelen)+sizeof(mic->u.snap)); emmh32_update(&context->seed, (u8 *)&mic->seq,sizeof(mic->seq)); emmh32_update(&context->seed, eth->da + ETH_ALEN*2,payLen); emmh32_final(&context->seed, digest); if (memcmp(digest, &mic->mic, 4)) { //Make sure the mics match if (i == 0) micError = INCORRECTMIC; continue; } if (RxSeqValid(ai, context, mcast, micSEQ) == SUCCESS) { ai->micstats.rxSuccess++; return SUCCESS; } if (i == 0) micError = SEQUENCE; } switch (micError) { case NOMICPLUMMED: ai->micstats.rxMICPlummed++; break; case SEQUENCE: ai->micstats.rxWrongSequence++; break; case INCORRECTMIC: ai->micstats.rxIncorrectMIC++; break; case NONE: break; case NOMIC: break; } return ERROR; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,196
static void disable_interrupts( struct airo_info *ai ) { OUT4500( ai, EVINTEN, 0 ); }
DoS
0
static void disable_interrupts( struct airo_info *ai ) { OUT4500( ai, EVINTEN, 0 ); }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,197
static int do_writerid( struct airo_info *ai, u16 rid, const void *rid_data, int len, int dummy ) { int rc; disable_MAC(ai, 1); rc = PC4500_writerid(ai, rid, rid_data, len, 1); enable_MAC(ai, 1); return rc; }
DoS
0
static int do_writerid( struct airo_info *ai, u16 rid, const void *rid_data, int len, int dummy ) { int rc; disable_MAC(ai, 1); rc = PC4500_writerid(ai, rid, rid_data, len, 1); enable_MAC(ai, 1); return rc; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,198
static void emmh32_final(emmh32_context *context, u8 digest[4]) { int coeff_position, byte_position; u32 val; u64 sum, utmp; s64 stmp; coeff_position = context->position >> 2; /* deal with partial 32-bit word left over from last update */ byte_position = context->position & 3; if (byte_position) { /* have a partial word in part to deal with */ val = ntohl(context->part.d32); MIC_ACCUM(val & mask32[byte_position]); /* zero empty bytes */ } /* reduce the accumulated u64 to a 32-bit MIC */ sum = context->accum; stmp = (sum & 0xffffffffLL) - ((sum >> 32) * 15); utmp = (stmp & 0xffffffffLL) - ((stmp >> 32) * 15); sum = utmp & 0xffffffffLL; if (utmp > 0x10000000fLL) sum -= 15; val = (u32)sum; digest[0] = (val>>24) & 0xFF; digest[1] = (val>>16) & 0xFF; digest[2] = (val>>8) & 0xFF; digest[3] = val & 0xFF; }
DoS
0
static void emmh32_final(emmh32_context *context, u8 digest[4]) { int coeff_position, byte_position; u32 val; u64 sum, utmp; s64 stmp; coeff_position = context->position >> 2; /* deal with partial 32-bit word left over from last update */ byte_position = context->position & 3; if (byte_position) { /* have a partial word in part to deal with */ val = ntohl(context->part.d32); MIC_ACCUM(val & mask32[byte_position]); /* zero empty bytes */ } /* reduce the accumulated u64 to a 32-bit MIC */ sum = context->accum; stmp = (sum & 0xffffffffLL) - ((sum >> 32) * 15); utmp = (stmp & 0xffffffffLL) - ((stmp >> 32) * 15); sum = utmp & 0xffffffffLL; if (utmp > 0x10000000fLL) sum -= 15; val = (u32)sum; digest[0] = (val>>24) & 0xFF; digest[1] = (val>>16) & 0xFF; digest[2] = (val>>8) & 0xFF; digest[3] = val & 0xFF; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null
19,199
static void emmh32_init(emmh32_context *context) { /* prepare for new mic calculation */ context->accum = 0; context->position = 0; }
DoS
0
static void emmh32_init(emmh32_context *context) { /* prepare for new mic calculation */ context->accum = 0; context->position = 0; }
@@ -2823,6 +2823,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, dev->wireless_data = &ai->wireless_data; dev->irq = irq; dev->base_addr = port; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; SET_NETDEV_DEV(dev, dmdev);
CWE-264
null
null