The branch releng/14.4 has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0671ffe268f2bff72356a2aba27c9965c9c403b4

commit 0671ffe268f2bff72356a2aba27c9965c9c403b4
Author:     Zhenlei Huang <[email protected]>
AuthorDate: 2026-02-06 17:52:53 +0000
Commit:     Colin Percival <[email protected]>
CommitDate: 2026-02-11 20:29:07 +0000

    qlnxe: Prevent potential concurrency between ioctls
    
    The driver-managed status flags should be lock protected to be touched.
    Also this can serialize ioctls those check the IFF_DRV_RUNNING status.
    
    Approved by:    re (cperciva)
    Reviewed by:    kbowling
    MFC after:      5 days
    Differential Revision:  https://reviews.freebsd.org/D54886
    
    (cherry picked from commit 0df8a998a9fe28af659cb401c537c6d785e55f81)
    (cherry picked from commit 285b25c080faf71c60de36e834ef31cf70e6b50d)
    (cherry picked from commit 6e5b12acb66a9e269801b8d88c8f9838044d631c)
---
 sys/dev/qlnx/qlnxe/qlnx_os.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c
index ec2fd7cacfae..b0dac3a82582 100644
--- a/sys/dev/qlnx/qlnxe/qlnx_os.c
+++ b/sys/dev/qlnx/qlnxe/qlnx_os.c
@@ -2568,9 +2568,7 @@ qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi)
 
        mcnt = if_foreach_llmaddr(ifp, qlnx_copy_maddr, mta);
 
-       QLNX_LOCK(ha);
        qlnx_hw_set_multi(ha, mta, mcnt, add_multi);
-       QLNX_UNLOCK(ha);
 
        return (0);
 }
@@ -2637,11 +2635,10 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data)
 #ifdef INET
                if (ifa->ifa_addr->sa_family == AF_INET) {
                        if_setflagbits(ifp, IFF_UP, 0);
-                       if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) {
-                               QLNX_LOCK(ha);
+                       QLNX_LOCK(ha);
+                       if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
                                qlnx_init_locked(ha);
-                               QLNX_UNLOCK(ha);
-                       }
+                       QLNX_UNLOCK(ha);
                        QL_DPRINT4(ha, "SIOCSIFADDR (0x%lx) ipv4 [0x%08x]\n",
                                   cmd, ntohl(IA_SIN(ifa)->sin_addr.s_addr));
 
@@ -2703,19 +2700,23 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data)
        case SIOCADDMULTI:
                QL_DPRINT4(ha, "%s (0x%lx)\n", "SIOCADDMULTI", cmd);
 
-               if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
+               QLNX_LOCK(ha);
+               if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) {
                        if (qlnx_set_multi(ha, 1))
                                ret = EINVAL;
                }
+               QLNX_UNLOCK(ha);
                break;
 
        case SIOCDELMULTI:
                QL_DPRINT4(ha, "%s (0x%lx)\n", "SIOCDELMULTI", cmd);
 
-               if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
+               QLNX_LOCK(ha);
+               if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) {
                        if (qlnx_set_multi(ha, 0))
                                ret = EINVAL;
                }
+               QLNX_UNLOCK(ha);
                break;
 
        case SIOCSIFMEDIA:

Reply via email to