Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3321055pxf; Mon, 15 Mar 2021 07:06:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHFiidwRoTr4H3HbX3zKS2RFw6lzYGIInHwm6qWgXBB7tCB9Wp9i3qKSC4Fm+TOpS6lBTz X-Received: by 2002:adf:f852:: with SMTP id d18mr28085706wrq.210.1615817169343; Mon, 15 Mar 2021 07:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817169; cv=none; d=google.com; s=arc-20160816; b=BjTgLmvbrP7buqlUfEBU8YO8F+NkTGBO6Qci69IFxuFWUb0bMxip00jqOGGaJyw93i k99/lcsojcZzAFvN34BbVIw5i+tE1He6R7B8zh5Veafsi1tY61JovTL55YBNAWh52sEe tSfCJtypFy7vnenRi52xd54WxDJ/T6ZornkKcV2Fa3kOTeM8JOlSYSd/VU2bt4NWfg4r U64JjIvH9TLvwwV5rEsYyorIJ/0Nyi5EsNUjWnClmJugwnTzqqlbGmGoPeU9jw0dBxTd N6Nn+JlWrHSjHjvt33NjMaOZOVuSh8dsaLvyoQ+dxcvAs7Aun6JOQCbDIfitF1Se4fNx MkHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Jut/0fG6+QZ+2gGGtfddqLMW2zSZanj07crZlMJW2LM=; b=Ex82O3e2slbuP5/ms9+NYJUUUcWbhYGBOr4gnmEwt3AqPcaK6W10XKjz7tw4BT9y7H iie0ZXvKBZy+kWsYxTUSaHOdlQvZM6feR44iuYcpeZaLfoag2J4u9tKMzxytsmET1lF7 mnlURMEbvcpFcNQ2EPOKNfNoQXM1EtvikycG/dxcZFyAkuU80cDPaYKBF2NCJNhgCiYC exAXJ6nXqyBjbhElcVSKIskwiEkcjW7eCWaxiLOR6P/rxMYOINGHvKT2vkePqWo/qcwS 34cdn1FJltVHJuGpTMrJu+MpUrOUqTceUyjEpG2Z4HZJpDR5m7IvRZJSW+IThLdqtJx8 2Viw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xs7UahQe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si10740093edh.13.2021.03.15.07.05.45; Mon, 15 Mar 2021 07:06:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xs7UahQe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234581AbhCOOEX (ORCPT + 99 others); Mon, 15 Mar 2021 10:04:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:34886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbhCON5V (ORCPT ); Mon, 15 Mar 2021 09:57:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 944C364F0C; Mon, 15 Mar 2021 13:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816640; bh=fgowpRYNBb9TtpvY7+SDkKL4ZtEN7QAeVIZq6rFT1mY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xs7UahQeO+fq7bGQY7lzUkDAcrvKx0Sl2I3yt57NXWjwM9NR/Hrp1pWQ3br4mPId7 B+5k6yD9jP1NOc2ANwwTVgU/dQDjuuqaFsKN5sxuJBRJBdB6lAfZvO/TP2qen+u0lc zBXtox5EKwC5aolriUmfgqqWLbdPGkL7FHgRc0SA= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junlin Yang , "David S. Miller" Subject: [PATCH 5.11 036/306] ibmvnic: remove excessive irqsave Date: Mon, 15 Mar 2021 14:51:39 +0100 Message-Id: <20210315135508.856738975@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Junlin Yang commit 69cdb7947adb816fc9325b4ec02a6dddd5070b82 upstream. ibmvnic_remove locks multiple spinlocks while disabling interrupts: spin_lock_irqsave(&adapter->state_lock, flags); spin_lock_irqsave(&adapter->rwi_lock, flags); As reported by coccinelle, the second _irqsave() overwrites the value saved in 'flags' by the first _irqsave(), therefore when the second _irqrestore() comes,the value in 'flags' is not valid,the value saved by the first _irqsave() has been lost. This likely leads to IRQs remaining disabled. So remove the second _irqsave(): spin_lock_irqsave(&adapter->state_lock, flags); spin_lock(&adapter->rwi_lock); Generated by: ./scripts/coccinelle/locks/flags.cocci ./drivers/net/ethernet/ibm/ibmvnic.c:5413:1-18: ERROR: nested lock+irqsave that reuses flags from line 5404. Fixes: 4a41c421f367 ("ibmvnic: serialize access to work queue on remove") Signed-off-by: Junlin Yang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/ibm/ibmvnic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -5474,9 +5474,9 @@ static int ibmvnic_remove(struct vio_dev * after setting state, so __ibmvnic_reset() which is called * from the flush_work() below, can make progress. */ - spin_lock_irqsave(&adapter->rwi_lock, flags); + spin_lock(&adapter->rwi_lock); adapter->state = VNIC_REMOVING; - spin_unlock_irqrestore(&adapter->rwi_lock, flags); + spin_unlock(&adapter->rwi_lock); spin_unlock_irqrestore(&adapter->state_lock, flags);