Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/dev/pcmcia Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/02af3b264eb7
branches:  netbsd-9
changeset: 1001440:02af3b264eb7
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jan 28 11:01:37 2020 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #662):

        sys/dev/pcmcia/if_xi.c: revision 1.93
        sys/arch/x86/pci/if_vmx.c: revision 1.54
        sys/dev/pci/if_de.c: revision 1.165
        sys/arch/arm/ti/if_cpsw.c: revision 1.10
        sys/arch/arm/omap/if_cpsw.c: revision 1.26
        sys/dev/isa/if_iy.c: revision 1.112
        sys/dev/pcmcia/if_ray.c: revision 1.96

Add ETHER_LOCK() and ETHER_UNLOCK() to protect ec_multiaddrs.

XXX These drivers don't check whether enm_addrlo and enm_addrhi are the same
or not, so it won't work correctly if an multicast address entry has a range.

Protect ec_multicnt.

diffstat:

 sys/arch/arm/omap/if_cpsw.c |   6 ++++--
 sys/arch/arm/ti/if_cpsw.c   |   6 ++++--
 sys/arch/x86/pci/if_vmx.c   |  10 ++++------
 sys/dev/isa/if_iy.c         |   6 +++---
 sys/dev/pci/if_de.c         |   8 ++++----
 sys/dev/pcmcia/if_ray.c     |   8 ++++----
 sys/dev/pcmcia/if_xi.c      |   9 ++++-----
 7 files changed, 27 insertions(+), 26 deletions(-)

diffs (290 lines):

diff -r 03688539fcb0 -r 02af3b264eb7 sys/arch/arm/omap/if_cpsw.c
--- a/sys/arch/arm/omap/if_cpsw.c       Tue Jan 28 10:21:39 2020 +0000
+++ b/sys/arch/arm/omap/if_cpsw.c       Tue Jan 28 11:01:37 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cpsw.c,v 1.25 2019/05/29 06:17:27 msaitoh Exp $     */
+/*     $NetBSD: if_cpsw.c,v 1.25.2.1 2020/01/28 11:01:37 martin Exp $  */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.25 2019/05/29 06:17:27 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.25.2.1 2020/01/28 11:01:37 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1543,9 +1543,11 @@
                cpsw_ale_remove_all_mc_entries(sc);
 
        /* Set other multicast addrs desired. */
+       ETHER_LOCK(ec);
        LIST_FOREACH(ifma, &ec->ec_multiaddrs, enm_list) {
                cpsw_ale_mc_entry_set(sc, ALE_PORT_MASK_ALL, ifma->enm_addrlo);
        }
+       ETHER_UNLOCK(ec);
 
        return 0;
 }
diff -r 03688539fcb0 -r 02af3b264eb7 sys/arch/arm/ti/if_cpsw.c
--- a/sys/arch/arm/ti/if_cpsw.c Tue Jan 28 10:21:39 2020 +0000
+++ b/sys/arch/arm/ti/if_cpsw.c Tue Jan 28 11:01:37 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cpsw.c,v 1.6.2.1 2019/11/27 13:46:45 martin Exp $   */
+/*     $NetBSD: if_cpsw.c,v 1.6.2.2 2020/01/28 11:01:37 martin Exp $   */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.1 2019/11/27 13:46:45 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.2 2020/01/28 11:01:37 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1555,9 +1555,11 @@
                cpsw_ale_remove_all_mc_entries(sc);
 
        /* Set other multicast addrs desired. */
+       ETHER_LOCK(ec);
        LIST_FOREACH(ifma, &ec->ec_multiaddrs, enm_list) {
                cpsw_ale_mc_entry_set(sc, ALE_PORT_MASK_ALL, ifma->enm_addrlo);
        }
+       ETHER_UNLOCK(ec);
 
        return 0;
 }
diff -r 03688539fcb0 -r 02af3b264eb7 sys/arch/x86/pci/if_vmx.c
--- a/sys/arch/x86/pci/if_vmx.c Tue Jan 28 10:21:39 2020 +0000
+++ b/sys/arch/x86/pci/if_vmx.c Tue Jan 28 11:01:37 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vmx.c,v 1.45.2.5 2019/12/26 20:19:37 martin Exp $   */
+/*     $NetBSD: if_vmx.c,v 1.45.2.6 2020/01/28 11:01:37 martin Exp $   */
 /*     $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $        */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.45.2.5 2019/12/26 20:19:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.45.2.6 2020/01/28 11:01:37 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -3320,16 +3320,15 @@
         */
        mode = VMXNET3_RXMODE_BCAST | VMXNET3_RXMODE_UCAST;
 
+       ETHER_LOCK(ec);
        if (ISSET(ifp->if_flags, IFF_PROMISC) ||
            ec->ec_multicnt > VMXNET3_MULTICAST_MAX)
                goto allmulti;
 
        p = sc->vmx_mcast;
-       ETHER_LOCK(ec);
        ETHER_FIRST_MULTI(step, ec, enm);
        while (enm != NULL) {
                if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
-                       ETHER_UNLOCK(ec);
                        /*
                         * We must listen to a range of multicast addresses.
                         * For now, just accept all multicasts, rather than
@@ -3346,17 +3345,16 @@
 
                ETHER_NEXT_MULTI(step, enm);
        }
-       ETHER_UNLOCK(ec);
 
        if (ec->ec_multicnt > 0) {
                SET(mode, VMXNET3_RXMODE_MCAST);
                ds->mcast_tablelen = p - sc->vmx_mcast;
        }
+       ETHER_UNLOCK(ec);
 
        goto setit;
 
 allmulti:
-       ETHER_LOCK(ec);
        SET(ec->ec_flags, ETHER_F_ALLMULTI);
        ETHER_UNLOCK(ec);
        SET(mode, (VMXNET3_RXMODE_ALLMULTI | VMXNET3_RXMODE_MCAST));
diff -r 03688539fcb0 -r 02af3b264eb7 sys/dev/isa/if_iy.c
--- a/sys/dev/isa/if_iy.c       Tue Jan 28 10:21:39 2020 +0000
+++ b/sys/dev/isa/if_iy.c       Tue Jan 28 11:01:37 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_iy.c,v 1.109.2.1 2019/11/14 15:38:02 martin Exp $   */
+/*     $NetBSD: if_iy.c,v 1.109.2.2 2020/01/28 11:01:37 martin Exp $   */
 /* #define IYDEBUG */
 /* #define IYMEMDEBUG */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.109.2.1 2019/11/14 15:38:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.109.2.2 2020/01/28 11:01:37 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -1305,6 +1305,7 @@
        iot = sc->sc_iot;
        ioh = sc->sc_ioh;
 
+       ETHER_LOCK(ecp);
        len = 6 * ecp->ec_multicnt;
 
        avail = sc->tx_start - sc->tx_end;
@@ -1330,7 +1331,6 @@
        bus_space_write_2(iot, ioh, MEM_PORT_REG, 0);
        bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, htole16(len));
 
-       ETHER_LOCK(ecp);
        ETHER_FIRST_MULTI(step, ecp, enm);
        while (enm) {
                /*
diff -r 03688539fcb0 -r 02af3b264eb7 sys/dev/pci/if_de.c
--- a/sys/dev/pci/if_de.c       Tue Jan 28 10:21:39 2020 +0000
+++ b/sys/dev/pci/if_de.c       Tue Jan 28 11:01:37 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_de.c,v 1.163 2019/05/29 10:07:29 msaitoh Exp $      */
+/*     $NetBSD: if_de.c,v 1.163.2.1 2020/01/28 11:01:37 martin Exp $   */
 
 /*-
  * Copyright (c) 1994-1997 Matt Thomas (matt%3am-software.com@localhost)
@@ -37,7 +37,7 @@
  *   board which support 21040, 21041, or 21140 (mostly).
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.163 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.163.2.1 2020/01/28 11:01:37 martin Exp $");
 
 #define        TULIP_HDR_DATA
 
@@ -3218,6 +3218,7 @@
        sc->tulip_if.if_flags &= ~IFF_ALLMULTI;
 #endif
        sc->tulip_if.if_start = tulip_ifstart;  /* so the setup packet gets queued */
+       ETHER_LOCK(ec);
        if (sc->tulip_multicnt > 14) {
                uint32_t *sp = sc->tulip_setupdata;
                unsigned hash;
@@ -3238,7 +3239,6 @@
                 * hardware).
                 */
                memset(sc->tulip_setupdata, 0, sizeof(sc->tulip_setupdata));
-               ETHER_LOCK(ec);
                ETHER_FIRST_MULTI(step, ec, enm);
                while (enm != NULL) {
                        if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) {
@@ -3256,7 +3256,6 @@
                        }
                        ETHER_NEXT_MULTI(step, enm);
                }
-               ETHER_UNLOCK(ec);
                /*
                 * No reason to use a hash if we are going to be
                 * receiving every multicast.
@@ -3288,6 +3287,7 @@
                        }
                }
        }
+       ETHER_UNLOCK(ec);
        if ((sc->tulip_flags & (TULIP_WANTHASHPERFECT | TULIP_WANTHASHONLY))
            == 0) {
                uint32_t *sp = sc->tulip_setupdata;
diff -r 03688539fcb0 -r 02af3b264eb7 sys/dev/pcmcia/if_ray.c
--- a/sys/dev/pcmcia/if_ray.c   Tue Jan 28 10:21:39 2020 +0000
+++ b/sys/dev/pcmcia/if_ray.c   Tue Jan 28 11:01:37 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ray.c,v 1.94.2.1 2019/10/23 19:43:24 martin Exp $   */
+/*     $NetBSD: if_ray.c,v 1.94.2.2 2020/01/28 11:01:37 martin Exp $   */
 
 /*
  * Copyright (c) 2000 Christian E. Hopps
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.94.2.1 2019/10/23 19:43:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.94.2.2 2020/01/28 11:01:37 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -2824,9 +2824,9 @@
        ec = &sc->sc_ec;
        ray_cmd_cancel(sc, SCP_UPD_MCAST);
 
+       ETHER_LOCK(ec);
        /* see if we have any ranges */
        if ((count = sc->sc_ec.ec_multicnt) < 17) {
-               ETHER_LOCK(ec);
                ETHER_FIRST_MULTI(step, ec, enm);
                while (enm) {
                        /* see if this is a range */
@@ -2837,8 +2837,8 @@
                        }
                        ETHER_NEXT_MULTI(step, enm);
                }
-               ETHER_UNLOCK(ec);
        }
+       ETHER_UNLOCK(ec);
 
        /* track this stuff even when not running */
        if (count > 16) {
diff -r 03688539fcb0 -r 02af3b264eb7 sys/dev/pcmcia/if_xi.c
--- a/sys/dev/pcmcia/if_xi.c    Tue Jan 28 10:21:39 2020 +0000
+++ b/sys/dev/pcmcia/if_xi.c    Tue Jan 28 11:01:37 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_xi.c,v 1.90.2.1 2019/11/06 09:59:38 martin Exp $ */
+/*     $NetBSD: if_xi.c,v 1.90.2.2 2020/01/28 11:01:37 martin Exp $ */
 /*     OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp   */
 
 /*
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.90.2.1 2019/11/06 09:59:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.90.2.2 2020/01/28 11:01:37 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -964,12 +964,12 @@
                        indaddr[i] = enaddr[i];
        num = 1;
 
+       ETHER_LOCK(ec);
        if (ec->ec_multicnt > 9) {
                ifp->if_flags |= IFF_ALLMULTI;
                goto done;
        }
 
-       ETHER_LOCK(ec);
        ETHER_FIRST_MULTI(step, ec, enm);
        for (; enm; num++) {
                if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
@@ -980,7 +980,6 @@
                         * XXX should we be setting IFF_ALLMULTI here?
                         */
                        ifp->if_flags |= IFF_ALLMULTI;
-                       ETHER_UNLOCK(ec);
                        goto done;
                }
                if (sc->sc_chipset >= XI_CHIPSET_MOHAWK)
@@ -991,10 +990,10 @@
                                indaddr[num * 6 + i] = enm->enm_addrlo[i];
                ETHER_NEXT_MULTI(step, enm);
        }
-       ETHER_UNLOCK(ec);
        ifp->if_flags &= ~IFF_ALLMULTI;
 
 done:
+       ETHER_UNLOCK(ec);
        if (num < 10)
                memset(&indaddr[num * 6], 0xff, 6 * (10 - num));
 



Home | Main Index | Thread Index | Old Index