From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 7739DC432C0 for ; Tue, 19 Nov 2019 06:12:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A11320692 for ; Tue, 19 Nov 2019 06:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574143938; bh=zubJqFSCl3jk3PoPLUGNliBu3gPSwgXG+N0VBbZMW4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jFtcdJPiD/SHIP6TH+yRwSCQuG7+nh9LG6rcMMXNIbe+mxinjt5b5DXvOht+n3hr6 Nap7tr4IUGjrvl2TBLLbBp3OTC09m+7X9ctV9T7m9hhoeSlhsjImIfO3xOIu2XIB3f s3fCtgTwyID0WycxNPphqA5WjZvUKkgUOWqGGXx0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727809AbfKSFWm (ORCPT ); Tue, 19 Nov 2019 00:22:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:38034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbfKSFWl (ORCPT ); Tue, 19 Nov 2019 00:22:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 23DD121939; Tue, 19 Nov 2019 05:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574140960; bh=zubJqFSCl3jk3PoPLUGNliBu3gPSwgXG+N0VBbZMW4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jprjtI1mgovOpT1p27sq9C8LoQtaj+EsNRcDpQMfptdrgwyXus5wGD/bVRfyYPQvJ KqGzVwhW6GZFu4C8n0gP9b0ZEsTwoBVnm15zecdbkDEcyx/AUfgn1I6ZJp6LIB2LmB XWICx3qKY1ZgfcTUAdrHo+XsXobaqZI5MeVcGVOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+8488cc4cf1c9e09b8b86@syzkaller.appspotmail.com, Ursula Braun , Karsten Graul , "David S. Miller" Subject: [PATCH 5.3 07/48] net/smc: fix fastopen for non-blocking connect() Date: Tue, 19 Nov 2019 06:19:27 +0100 Message-Id: <20191119050953.406107089@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119050946.745015350@linuxfoundation.org> References: <20191119050946.745015350@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ursula Braun [ Upstream commit 8204df72bea1a7d83d0777add6da98a41dfbdc34 ] FASTOPEN does not work with SMC-sockets. Since SMC allows fallback to TCP native during connection start, the FASTOPEN setsockopts trigger this fallback, if the SMC-socket is still in state SMC_INIT. But if a FASTOPEN setsockopt is called after a non-blocking connect(), this is broken, and fallback does not make sense. This change complements commit cd2063604ea6 ("net/smc: avoid fallback in case of non-blocking connect") and fixes the syzbot reported problem "WARNING in smc_unhash_sk". Reported-by: syzbot+8488cc4cf1c9e09b8b86@syzkaller.appspotmail.com Fixes: e1bbdd570474 ("net/smc: reduce sock_put() for fallback sockets") Signed-off-by: Ursula Braun Signed-off-by: Karsten Graul Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/smc/af_smc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -1731,7 +1731,7 @@ static int smc_setsockopt(struct socket case TCP_FASTOPEN_KEY: case TCP_FASTOPEN_NO_COOKIE: /* option not supported by SMC */ - if (sk->sk_state == SMC_INIT) { + if (sk->sk_state == SMC_INIT && !smc->connect_nonblock) { smc_switch_to_fallback(smc); smc->fallback_rsn = SMC_CLC_DECL_OPTUNSUPP; } else {