Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2223358imm; Thu, 18 Oct 2018 10:58:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV63ZXjXs+lz7sbTA0pa5Sr8f6w8we5GKjq/S1zEHuVOn4/X0KRQlF/azENOMD01hZ2mnwIxY X-Received: by 2002:a62:ce83:: with SMTP id y125-v6mr31563121pfg.201.1539885504045; Thu, 18 Oct 2018 10:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539885504; cv=none; d=google.com; s=arc-20160816; b=HlKh6R9+8yX+MhW9rWsO4Avn+LZ6rneqOB8NhA9aURxRzQKsWimFxi6n/HQcRgc4/H u6O3n5eolA6/ng/V13S+p/adVVm/mfdljGHwKyniaq/oTEF210u9fUS+W0qqZ9xsO8FD IV/hDrUjNrQTr0d6KthPnU7Hsr6P/K2yfOX4ta8+MK3MTfMNhEAZwJN4K2dzdSzMcDZP e+/hWCb5ZwjODsYnSiWYu9LfbBLQNkpDRlm5AhqyiktL4T2Wx7AiJ4qOoqBRDxgj9uit YnWnVrAGZeHtWnERCNcbnvUemP3NaoKwQoLn8gMLYFfJY/17midUgjvFO81ytxW+y5BD R7Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dEcyGstUq5dHRQRnS9wJ1qybTpNtGIz77hoslk8/Pcw=; b=rukBAUUGQLaIhYNpvg6BV/X1w6mXaWpPEcnqVE9aX1qUuwLEsHU3L+g4dB2wBInT1Y fqk5GSLHbi/vrFUHWKSHfBGmdQMnU2kR0JXVP7rDOuVGcRefB+iocx38duRoMs5xOobc 5zXWMjNb6PS/5Eriq3cxMw1+ZcPAhsxUpSfL3QyFZZHrCREwXV2N5Iy34F/v5uHYrl5I RDpdtyS/uNJVmbK0GFJb7YCOHIcrncgclTsW8JixuWQtjkpcGbHsDekVvyxsMPFmmup4 Lpyi11bxv4GuM80XaQO/DQB0ST1zyh9q3kG/z7cyIalI55hnhpW8EzzACuFZdrlLLTOC z4kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kxg0QxCj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7-v6si17641208pll.131.2018.10.18.10.58.08; Thu, 18 Oct 2018 10:58:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kxg0QxCj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728829AbeJSB7X (ORCPT + 99 others); Thu, 18 Oct 2018 21:59:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:47062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728086AbeJSB7W (ORCPT ); Thu, 18 Oct 2018 21:59:22 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 D2195204FD; Thu, 18 Oct 2018 17:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885437; bh=OIEbDd7aqEb1QF43vSqSUrjSxkiexFEfXe5gzvK4QcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kxg0QxCj4+00pu480Px1ke5RHfy7VTfPjcZwkNxscY7/Cr5OuipaflRkaTpB4iWfd btwsTLDz8VhB0eS5Sa+u5vAKT1f4c7seKqvMv8eF5yFWuUZgfo2DfY0uDoLunmm0uH VxSJy0f3Loi5Ai76xJvZMjRc+ZXdeNh1En/jfDcA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ursula Braun , "David S. Miller" , Sasha Levin Subject: [PATCH 4.18 26/53] net/smc: fix non-blocking connect problem Date: Thu, 18 Oct 2018 19:54:19 +0200 Message-Id: <20181018175421.524799261@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175416.561567978@linuxfoundation.org> References: <20181018175416.561567978@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ursula Braun [ Upstream commit 648a5a7aed346c3b8fe7c32a835edfb0dfbf4451 ] In state SMC_INIT smc_poll() delegates polling to the internal CLC socket. This means, once the connect worker has finished its kernel_connect() step, the poll wake-up may occur. This is not intended. The wake-up should occur from the wake up call in smc_connect_work() after __smc_connect() has finished. Thus in state SMC_INIT this patch now calls sock_poll_wait() on the main SMC socket. Signed-off-by: Ursula Braun Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/smc/af_smc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -612,7 +612,10 @@ static void smc_connect_work(struct work smc->sk.sk_err = -rc; out: - smc->sk.sk_state_change(&smc->sk); + if (smc->sk.sk_err) + smc->sk.sk_state_change(&smc->sk); + else + smc->sk.sk_write_space(&smc->sk); kfree(smc->connect_info); smc->connect_info = NULL; release_sock(&smc->sk); @@ -1345,7 +1348,7 @@ static __poll_t smc_poll(struct file *fi return EPOLLNVAL; smc = smc_sk(sock->sk); - if ((sk->sk_state == SMC_INIT) || smc->use_fallback) { + if (smc->use_fallback) { /* delegate to CLC child sock */ mask = smc->clcsock->ops->poll(file, smc->clcsock, wait); sk->sk_err = smc->clcsock->sk->sk_err;