Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2490527ybl; Thu, 29 Aug 2019 08:53:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMqNHdWOKhhlyJU5KJ0yY7VNMn3NCvzmXKhIEw9ePbjtyRiMkIwlEpnjblCr7yJC4QXkx/ X-Received: by 2002:a17:90a:be07:: with SMTP id a7mr10565330pjs.88.1567094008031; Thu, 29 Aug 2019 08:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567094008; cv=none; d=google.com; s=arc-20160816; b=NxGBrivWg9H4Q6Lf9akubYvEMT4c31rIFHtQ5Imhj/3CzXqkBxtv1Mcy6zwTTz7oQc 8Nb2iGZSQe8gTi5w/zj0mKxgvSYyTfcN+sDPDwM0+4BX+X6oUPlNgW097kkPtVpoa0Tr EkaGdKze+jBGhcIlz+cYWHG8+41lI8kCvku5urCc94a8iXdb8lowmlxMWoMoWvHy5Cbd 4cJ1ttGAAZEoWoKSDg+pf+XHUq4AsDZpBYJI6MNU18CAn6FuFoafJ/b/AixVAC4dyggY +oAUoqNNv2B7bEYSDdYsok/QV0ZUWHkwRFYvOrk9YRu6EcGNcUJq0lSOSMCwn2yOyoMr G/bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from; bh=Wwwf32ObF1xLucFEHAFjtwwvyjXZtbmezJpZBAdYoqM=; b=hbYrA2oim9cqtXsINPlJmnSPn97vCPDGleH1FcWksx3wZrnRJ5bKw+85AdNyuALPSc ZAtuGYfW+/H4RAQvzKT/EIUhNXwVWis1EGgm/+d2q5L3JobAIQC1Aop80klZQmTDNaA0 jmHDDYsOcqXRkcEpLu0fn6DtlLvMUBQW1gbmKfWzYHIW6grKq+5abAXL+LOMFjBCLWz8 ouLGA5BvuySitU0eZel/u16o5ZEhyFuHmTY9rEJpuqw4kE/rnvUzdOYDuqkDiII6RBf0 xcj7fvIp1CARgk5BmF1qOJ8UwmUQHufCU3bhtniIKtYov9EpXUeVV/Xrq+W/OQhrwpvH iUsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r74si3134214pfr.79.2019.08.29.08.53.11; Thu, 29 Aug 2019 08:53:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728673AbfH2Pvk (ORCPT + 99 others); Thu, 29 Aug 2019 11:51:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:32846 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728301AbfH2Pui (ORCPT ); Thu, 29 Aug 2019 11:50:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CE61BB6A1; Thu, 29 Aug 2019 15:50:36 +0000 (UTC) From: Thomas Bogendoerfer To: Ralf Baechle , Paul Burton , James Hogan , "David S. Miller" , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 net-next 14/15] net: sgi: ioc3-eth: protect emcr in all cases Date: Thu, 29 Aug 2019 17:50:12 +0200 Message-Id: <20190829155014.9229-15-tbogendoerfer@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20190829155014.9229-1-tbogendoerfer@suse.de> References: <20190829155014.9229-1-tbogendoerfer@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org emcr in private struct wasn't always protected by spinlock. Signed-off-by: Thomas Bogendoerfer --- drivers/net/ethernet/sgi/ioc3-eth.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c index 00942b37a1e4..d2b6659adba6 100644 --- a/drivers/net/ethernet/sgi/ioc3-eth.c +++ b/drivers/net/ethernet/sgi/ioc3-eth.c @@ -729,6 +729,8 @@ static inline void ioc3_setup_duplex(struct ioc3_private *ip) { struct ioc3_ethregs *regs = ip->regs; + spin_lock_irq(&ip->ioc3_lock); + if (ip->mii.full_duplex) { writel(ETCSR_FD, ®s->etcsr); ip->emcr |= EMCR_DUPLEX; @@ -737,6 +739,8 @@ static inline void ioc3_setup_duplex(struct ioc3_private *ip) ip->emcr &= ~EMCR_DUPLEX; } writel(ip->emcr, ®s->emcr); + + spin_unlock_irq(&ip->ioc3_lock); } static void ioc3_timer(struct timer_list *t) @@ -1628,6 +1632,8 @@ static void ioc3_set_multicast_list(struct net_device *dev) netif_stop_queue(dev); /* Lock out others. */ + spin_lock_irq(&ip->ioc3_lock); + if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ ip->emcr |= EMCR_PROMISC; writel(ip->emcr, ®s->emcr); @@ -1656,6 +1662,8 @@ static void ioc3_set_multicast_list(struct net_device *dev) writel(ip->ehar_l, ®s->ehar_l); } + spin_unlock_irq(&ip->ioc3_lock); + netif_wake_queue(dev); /* Let us get going again. */ } -- 2.13.7