Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753949AbbHCPBg (ORCPT ); Mon, 3 Aug 2015 11:01:36 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:33366 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753585AbbHCPBe (ORCPT ); Mon, 3 Aug 2015 11:01:34 -0400 Message-ID: <55BF8244.4010509@roeck-us.net> Date: Mon, 03 Aug 2015 08:01:24 -0700 From: Guenter Roeck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Vivien Didelot , netdev@vger.kernel.org CC: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Andrew Lunn , Florian Fainelli Subject: Re: [PATCH] net: dsa: mv88e6xxx: call _mv88e6xxx_stats_wait with SMI lock held References: <1438607864-17829-1-git-send-email-vivien.didelot@savoirfairelinux.com> In-Reply-To: <1438607864-17829-1-git-send-email-vivien.didelot@savoirfairelinux.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated_sender: linux@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1799 Lines: 51 On 08/03/2015 06:17 AM, Vivien Didelot wrote: > At switch setup, _mv88e6xxx_stats_wait was called without holding the > SMI mutex. Fix this by requesting the lock for this call. > > Also, return the _mv88e6xxx_stats_wait code, since it may fail. > > Signed-off-by: Vivien Didelot Not strictly needed because the mutex is initialized in the same call sequence, but it doesn't hurt and is technically ok (and may prevent others from submitting the same patch again ;-) Reviewed-by: Guenter Roeck > --- > drivers/net/dsa/mv88e6xxx.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c > index 5e1dce1..8966cf2 100644 > --- a/drivers/net/dsa/mv88e6xxx.c > +++ b/drivers/net/dsa/mv88e6xxx.c > @@ -1938,6 +1938,7 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds) > int mv88e6xxx_setup_global(struct dsa_switch *ds) > { > struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); > + int ret; > int i; > > /* Set the default address aging time to 5 minutes, and > @@ -2036,9 +2037,11 @@ int mv88e6xxx_setup_global(struct dsa_switch *ds) > REG_WRITE(REG_GLOBAL, GLOBAL_STATS_OP, GLOBAL_STATS_OP_FLUSH_ALL); > > /* Wait for the flush to complete. */ > - _mv88e6xxx_stats_wait(ds); > + mutex_lock(&ps->smi_mutex); > + ret = _mv88e6xxx_stats_wait(ds); > + mutex_unlock(&ps->smi_mutex); > > - return 0; > + return ret; > } > > int mv88e6xxx_switch_reset(struct dsa_switch *ds, bool ppu_active) > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/