Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2490295pxj; Mon, 10 May 2021 04:21:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtDrRAcxquZEVFmv17sMSMJ0l29irOMwqT6w5To+c4Xg2IkDlkzbUpWGHoj4YIMOPVTAIF X-Received: by 2002:a17:906:f84:: with SMTP id q4mr3233223ejj.442.1620645708281; Mon, 10 May 2021 04:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645708; cv=none; d=google.com; s=arc-20160816; b=ZSk4jUKZkeKxKAZj5JJIhw5RhnHGxIsZmFt2UYuqswH4jQbt3k7NO9STdsa+/O9orc jGFM/0u/sMhGBBtzSnAsYonpwZg0OSl1v8ACY0OWCjXONNQxNZxNcHaPT/8i1hfISbpL JSV/R/0bIg2J6tBoubQb6t9TJ7phcFKwyWSv8Tp8bho/tC9nRkFKJJGFXom0Pwh70BMb q4pc8Tu1PEIIfSXIMWeQT3bkNUiLeQ0/JtGc3+cGcblO+aUTS9noDe71vEwLHuH5EjWp U3haf1/N9MjyXl2u0mVbpO2+6Q2Y7OgTU37VmS0FzmjURDU/Wk/ch8PX6OvbZQJdMYtw 4ctg== 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=ZxGXCMojEdnKZoQJnNhYQ0LHcdSCHLqeAACN1lQglTM=; b=A/1+bj0U3EG71X1hPRSyNPQ+twtFEqeTTcdwoJSTTjka2XqayTNFxGODV1oIyRwGwg iAS7+tV+IndhSW5Eq4H3VXkM6jWxSkq/upOLPc9m8yO2JIZVe1o4DND0IKF3bRvS+a9R orKUYHCNkDwgE1yO5Uc52R/Zt6OCx/cFbl24bE5xWdT7u5Q0e7tIj95P0HWz6ZwY9n8c 21C8cSIke4YcrDP1on15L5UyvNfzU/qB20t9YPyYKyYDCDhoKSW+C/3hX+EkEhvaL0wr TGJcjgKdR3su2wLo3tYirBCqcRRF+vQ3UTIr6MgHXWv515N5PC7vNjNyFdHQ5DaGJEtZ y9pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PbmR5RSo; 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 i18si3549150ejz.246.2021.05.10.04.21.24; Mon, 10 May 2021 04:21:48 -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=PbmR5RSo; 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 S238224AbhEJLRQ (ORCPT + 99 others); Mon, 10 May 2021 07:17:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:42174 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbhEJKxU (ORCPT ); Mon, 10 May 2021 06:53:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCE8261108; Mon, 10 May 2021 10:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643285; bh=tP1U7H4312HGX/MWFARpFwLuhVw15lE1SvLcNcr+1OQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PbmR5RSoF4awGwbDFKvqu5LBGTTlRHdyfQjt4Vr3MFT3SLCCCassjBl51FBM9PIIf VuhTj4ECyMq7uqLm0U8NzVHpJF/Uo0c2Xh1FwvjrUCDQg2cUTLwwIJq6/U6sSqK8tx QuWrAFPCMXG1SoS78q1GP0MXGkBOPPSuSQjj1Nh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trevor Hemsley , Edward Cree , "David S. Miller" Subject: [PATCH 5.10 253/299] sfc: farch: fix TX queue lookup in TX flush done handling Date: Mon, 10 May 2021 12:20:50 +0200 Message-Id: <20210510102013.310295698@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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: Edward Cree commit 5b1faa92289b53cad654123ed2bc8e10f6ddd4ac upstream. We're starting from a TXQ instance number ('qid'), not a TXQ type, so efx_get_tx_queue() is inappropriate (and could return NULL, leading to panics). Fixes: 12804793b17c ("sfc: decouple TXQ type from label") Reported-by: Trevor Hemsley Cc: stable@vger.kernel.org Signed-off-by: Edward Cree Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/sfc/farch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c @@ -1081,16 +1081,16 @@ static void efx_farch_handle_tx_flush_done(struct efx_nic *efx, efx_qword_t *event) { struct efx_tx_queue *tx_queue; + struct efx_channel *channel; int qid; qid = EFX_QWORD_FIELD(*event, FSF_AZ_DRIVER_EV_SUBDATA); if (qid < EFX_MAX_TXQ_PER_CHANNEL * (efx->n_tx_channels + efx->n_extra_tx_channels)) { - tx_queue = efx_get_tx_queue(efx, qid / EFX_MAX_TXQ_PER_CHANNEL, - qid % EFX_MAX_TXQ_PER_CHANNEL); - if (atomic_cmpxchg(&tx_queue->flush_outstanding, 1, 0)) { + channel = efx_get_tx_channel(efx, qid / EFX_MAX_TXQ_PER_CHANNEL); + tx_queue = channel->tx_queue + (qid % EFX_MAX_TXQ_PER_CHANNEL); + if (atomic_cmpxchg(&tx_queue->flush_outstanding, 1, 0)) efx_farch_magic_event(tx_queue->channel, EFX_CHANNEL_MAGIC_TX_DRAIN(tx_queue)); - } } }