Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2673602pxb; Mon, 19 Apr 2021 10:57:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySNI90nfAxTDHaQ49ah2G/q+7PQvDeTd7LMSzWDc9BIKLW6sSKRwffy9lsGm+XieCN2hJ3 X-Received: by 2002:a17:90a:b947:: with SMTP id f7mr301058pjw.166.1618855029271; Mon, 19 Apr 2021 10:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618855029; cv=none; d=google.com; s=arc-20160816; b=rQ+EdwRaDIoAZPzx2xQGdHI4d74B2a6/JJhAL5R3xK2dUBQ+CXn3/M+WC5m4kMj+At VFiDmuOZiDW09/+ZFynQEqwcp/lz62q8HxKM8dUEl8dr4onvYGWed/YZUYwJ30XfqRjg zIZkUy8PZbxCDfYAPKbaE7jvo8csCQs6XdrkX5Vg2l+Au2pxG7xPY1lTl8h6SqzvzulM /C0bAIrJL5q9VU05ggrXl628l8Zo4bu3OM3NSnNL6gU8Y6rgRKodzEhoBDwLmNO1tZom Oa6RoSWEPATvmkh6nRQ28Yl3qI/sISa2a5gHDYBNHD3CmnICOjl05bV3PsTtxnf80anj mMZQ== 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=L/Ci/nQ2nBDQi+9+T1QqsS/kKUo9D8HPlyUS9DifXfk=; b=flqsMaaYrwdz+YBkFkn3YNF32gRoxYrSdD0R48RIifwwMWepzlqrkYBv+PmH2A7gVl LmLORIlPNtkwbwDbJS/gIMeFtsJLfJMVEVOm+szMaDO91bN3/A+U98IwLStL03kN22Os qgvGOhlU8zolEyMyIMfpDl793dbN35Co2jtL+gJ697Ss+aaFRezfKeTbKT0Vli4Zp/Gu esnsZuZA8Get9UecTgg3Ap7LaZhmRRGpFgectN7kDu3HALA/hf6Pqg+F8pHZ424s8TbP RHxs7gH/6PWphzxr0iiZFggJxlG9w0VkMEiGy6UhrScmAPEHYRNv82ecVYtLtYZ1db6y bO9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LlgIioGV; 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 144si18745815pfc.264.2021.04.19.10.56.57; Mon, 19 Apr 2021 10:57: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=LlgIioGV; 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 S239394AbhDSNa4 (ORCPT + 99 others); Mon, 19 Apr 2021 09:30:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:55434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240842AbhDSNVa (ORCPT ); Mon, 19 Apr 2021 09:21:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E50766101C; Mon, 19 Apr 2021 13:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838272; bh=SUDhzk7ZeHooTxtWc+9vKxnQjlgp7BIYqkRcSI1koOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LlgIioGVzFlqYPMK6NN5Jurtjj/4SvgSriFJLcfMzLHyMh4JsmQDauZmaIuMq0HYe RWmZFGINCoGQhufuFXwGqSJP85mkmJPb+hLZVC+9Svtk4zPYwjoZffU5075TGRvwD3 gkiQqHLMwurnmeC4xjLdCMVrVuAVewGLnwjhcXGU= 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 5.10 078/103] ibmvnic: avoid calling napi_disable() twice Date: Mon, 19 Apr 2021 15:06:29 +0200 Message-Id: <20210419130530.488965404@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130527.791982064@linuxfoundation.org> References: <20210419130527.791982064@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 @@ -1159,8 +1159,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; }