Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3411166pxy; Mon, 26 Apr 2021 00:45:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqkbqaaT1/wEj/7y4tH1M8HAUQuT4/JHJ7zQKrMQGqiOKnMLzUG04iVzdsAolsO2XcJPjO X-Received: by 2002:a17:903:4101:b029:ea:fc8a:9adb with SMTP id r1-20020a1709034101b02900eafc8a9adbmr17191236pld.49.1619423133266; Mon, 26 Apr 2021 00:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619423133; cv=none; d=google.com; s=arc-20160816; b=ZpNmasqDBTMtEjU7Dhw3dnb5JUN9x4EbQAvZJZLmkZ9btTnwNTJI5AOyMT5wwOU3Et 6e7Uu0zUW4PKRS5XPdQO35Ywf9s9U4JeaO9JHjRsYdtE7NE2xxD/6nhX9cBZGZLP6nLH xeQ8u2heyIE9wYsLhHO5SFems5kSqDqXFJGBXHtjDJv6xIoMz3BzEq7owqoLAfEqZGz8 tAiy+vA3WgSX9DMDWlK9NpRJbwUa0/r/Pe5QD3uYVnnZAxG/Hrc/NNhkOOmSGBcdDCNV MPjXPUgI90FGtmXJfaxIFk+iOX62xDvV0RD+9dTJpkFA5Fb4N8BtJSr7o62OFCUjOr3i 4+cg== 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=YxhK+GZaqR/QQg7Fp4Qu2U2A6wDiKpEwXdSUrKilXbI=; b=lUTKtKa3OputicSuYowIuncrnshfeVWufWY6/1lGOPPc6V/3VFQxs8FHS7IKt9BDxP p5PjunAsvPoqyW8IOmMw3n2nxTGK4CkQ6eBH63cIawJRL0N6WHplvbxnM1q/qR3sMg44 SB50C8ZlMZgA73L3xBrI1pDFvBm96KL20phkk9zps6DElU0tU6lKRsV9tkzqOiw35noM zfCbjQ96Pud4Sdh+EmyodfdMpyuh9HAXehBAHt8tYBeQLi57r+u0qO93MqhQBRnNkq2f oRuhg6rBxbCOu900EB87GQBpzvTOCA1B7EvqAL2AsF2Y9qAVYKGELIXnDxuKybgHfPGt EjKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FhHZoKeI; 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 1si21008438pjg.151.2021.04.26.00.45.21; Mon, 26 Apr 2021 00:45:33 -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=FhHZoKeI; 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 S233075AbhDZHnX (ORCPT + 99 others); Mon, 26 Apr 2021 03:43:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:46814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbhDZHhc (ORCPT ); Mon, 26 Apr 2021 03:37:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C28D6611C1; Mon, 26 Apr 2021 07:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619422540; bh=N0qrNNmDrvxPiMqZ1gkFjGfWlPaqdm4+8Qx63p5iI4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FhHZoKeIRDnUfnkKMWc7ncrNFFLNG/JvvlCXWHUp9T+adYfuS5nbXJ7fAsQT6jsMh a1pyFYGxY3qjN5MykTH5OS2n7hspLdQtajrVhGTjwkCjEsr3UBse/bJa5RF4Kt52Dc HmAwEW5dxJrMzl/qsdO5aWsa8o+Uy7TMfI8qYo1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Falcon , Lijun Pan , "David S. Miller" Subject: [PATCH 4.14 31/49] ibmvnic: avoid calling napi_disable() twice Date: Mon, 26 Apr 2021 09:29:27 +0200 Message-Id: <20210426072820.781470176@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210426072819.721586742@linuxfoundation.org> References: <20210426072819.721586742@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: Lijun Pan commit 0775ebc4cf8554bdcd2c212669a0868ab68df5c0 upstream. __ibmvnic_open calls napi_disable without checking whether NAPI polling has already been disabled or not. This could cause napi_disable being called twice, which could generate deadlock. For example, the first napi_disable will spin until NAPI_STATE_SCHED is cleared by napi_complete_done, then set it again. When napi_disable is called the second time, it will loop infinitely because no dev->poll will be running to clear NAPI_STATE_SCHED. To prevent above scenario from happening, call ibmvnic_napi_disable() which checks if napi is disabled or not before calling napi_disable. Fixes: bfc32f297337 ("ibmvnic: Move resource initialization to its own routine") Suggested-by: Thomas Falcon Signed-off-by: Lijun Pan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/ibm/ibmvnic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -891,8 +891,7 @@ static int __ibmvnic_open(struct net_dev rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_UP); if (rc) { - for (i = 0; i < adapter->req_rx_queues; i++) - napi_disable(&adapter->napi[i]); + ibmvnic_napi_disable(adapter); release_resources(adapter); return rc; }