From patchwork Tue Oct 27 13:46:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 312080 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65124C388F9 for ; Tue, 27 Oct 2020 17:22:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C74921D7B for ; Tue, 27 Oct 2020 17:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603819368; bh=l6PdRIk2q9kQkm+pHSYC9bMdJ4FHIN5XHDF1uNwVZbc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FYbPPes9nYI+tfqhF65KM7jZ5XM77Y49klT++PePssrF55Jx3p/6HKeN0Phi8N6hu PlD36kNETBLFznxJBLttmYeAanlQKsndc0eFoGoaQ2zGAgEvLqfNzWtXAbf+ObUZ51 9EuoMEJ2WWAg8nxcq14qIYuw/DRzRwaKKDUnBpPE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S368511AbgJ0Oy4 (ORCPT ); Tue, 27 Oct 2020 10:54:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:49162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1766449AbgJ0OtD (ORCPT ); Tue, 27 Oct 2020 10:49:03 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 040A8206E5; Tue, 27 Oct 2020 14:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810142; bh=l6PdRIk2q9kQkm+pHSYC9bMdJ4FHIN5XHDF1uNwVZbc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IHKQBxC5W22PXXrs7Tg4DP0CX1VmVQMjw7oFYkkegEr5WbITIIHzbjJPW0wSqUM/N xNVDii/IZlmG6V+TwVwIPQ/sWZSrlhBGgNz/qE/Om+5IzSA0vJoKSYrZhxjKo/EuJ2 o230SHaGNdL4jatjNT/6KQGQhFebZkVEKGSkTQ9U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Venkatesh Ellapu , Vinay Kumar Yadav , Jakub Kicinski Subject: [PATCH 5.8 035/633] chelsio/chtls: Fix panic when listen on multiadapter Date: Tue, 27 Oct 2020 14:46:18 +0100 Message-Id: <20201027135524.343801775@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vinay Kumar Yadav [ Upstream commit 9819f22c410b4bf6589d3126e8bc3952db507cbf ] Add the logic to compare net_device returned by ip_dev_find() with the net_device list in cdev->ports[] array and return net_device if matched else NULL. Fixes: 6abde0b24122 ("crypto/chtls: IPv6 support for inline TLS") Signed-off-by: Venkatesh Ellapu Signed-off-by: Vinay Kumar Yadav Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/chelsio/chtls/chtls_cm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/drivers/crypto/chelsio/chtls/chtls_cm.c +++ b/drivers/crypto/chelsio/chtls/chtls_cm.c @@ -92,11 +92,13 @@ static void chtls_sock_release(struct kr static struct net_device *chtls_find_netdev(struct chtls_dev *cdev, struct sock *sk) { + struct adapter *adap = pci_get_drvdata(cdev->pdev); struct net_device *ndev = cdev->ports[0]; #if IS_ENABLED(CONFIG_IPV6) struct net_device *temp; int addr_type; #endif + int i; switch (sk->sk_family) { case PF_INET: @@ -127,8 +129,12 @@ static struct net_device *chtls_find_net return NULL; if (is_vlan_dev(ndev)) - return vlan_dev_real_dev(ndev); - return ndev; + ndev = vlan_dev_real_dev(ndev); + + for_each_port(adap, i) + if (cdev->ports[i] == ndev) + return ndev; + return NULL; } static void assign_rxopt(struct sock *sk, unsigned int opt)