Received: by 10.192.165.148 with SMTP id m20csp812518imm; Fri, 27 Apr 2018 07:56:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpuzt7VSnVY3hzMjEgs14Pf40Mfb16lLcFr/IJGZ9dzSmUbMjAVvCW2RlcXZh9AMWLeO6fH X-Received: by 10.98.106.10 with SMTP id f10mr2450782pfc.99.1524840974189; Fri, 27 Apr 2018 07:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524840974; cv=none; d=google.com; s=arc-20160816; b=XO+34sIWoMWESIu9ZiApEZABAfxVGzi6MMvuNNNZFAS1UpWqJedMFQE1KQZfRePzki TeswvIE8hfSDTwBsVuv9uTz96Li8kkQ2+8dhLRyZ+qeDQ50BDH7hYX+tsVfuRxMDDwAZ hnY35blbAj/NvO30qmVXc10GtaZcWZSMqhvH4tNkT7dVGc6/CmmSlhdGwNqM8gLHoVdx VCalaQAfXkB1Tidj/iL4gDEfzVVdOAzLqTN5jmddusKXmQvLoXrWCLNU5y8m3/PXgCQ3 EtTK0D3NYo1ShQsULC7vpvIhDwqW9RartgNvPu5rdrsglYZH1ok6uPtnE4JSi2ZDEr0+ bpfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=xnKfPoBUUxFNIr15mKFuKUCV1I6uYSrl7Wz6M2LVuq0=; b=Rsw2/x265YkC2Gnl+zvQCn2bWd0FF2IbY+Vc9PApIGOo1bVBowv/I0LgRObKTCKeKo /gJXHulRKSRXQYo2q0UZKYk/8KLva7DQY9Ck0ErotrJQV3arfElYZEtL77JGBxAromJJ RVHa5m2m0PpuiAgJysvaEbvXo4HqwD0Elf2bSt0qy4FLKYvpu5vPWBNzdMyTKkiwf7we Ig07ykAZv3DWFY4LcX/yqhlfHS1WgK7kxFTwSFgaDNctvIh2M/fgWOWEuHls+J6qtEt3 asXFutDJ3MA4BaypzvvD4ZyM/F0MD+i0WZM1DTggVoMLiQlU5RV+2A7PSYjviHkIzBdT t41A== ARC-Authentication-Results: i=1; mx.google.com; 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 f15-v6si1357053pgu.455.2018.04.27.07.56.00; Fri, 27 Apr 2018 07:56:14 -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; 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 S934152AbeD0OGg (ORCPT + 99 others); Fri, 27 Apr 2018 10:06:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:52552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934122AbeD0OGc (ORCPT ); Fri, 27 Apr 2018 10:06:32 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 7E37221890; Fri, 27 Apr 2018 14:06:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E37221890 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ursula Braun , Stephen Hemminger , "David S. Miller" Subject: [PATCH 4.14 20/80] net/smc: fix shutdown in state SMC_LISTEN Date: Fri, 27 Apr 2018 15:58:13 +0200 Message-Id: <20180427135733.945798926@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135732.928644313@linuxfoundation.org> References: <20180427135732.928644313@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ursula Braun [ Upstream commit 1255fcb2a655f05e02f3a74675a6d6525f187afd ] Calling shutdown with SHUT_RD and SHUT_RDWR for a listening SMC socket crashes, because commit 127f49705823 ("net/smc: release clcsock from tcp_listen_worker") releases the internal clcsock in smc_close_active() and sets smc->clcsock to NULL. For SHUT_RD the smc_close_active() call is removed. For SHUT_RDWR the kernel_sock_shutdown() call is omitted, since the clcsock is already released. Fixes: 127f49705823 ("net/smc: release clcsock from tcp_listen_worker") Signed-off-by: Ursula Braun Reported-by: Stephen Hemminger Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/smc/af_smc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -1203,14 +1203,12 @@ static int smc_shutdown(struct socket *s rc = smc_close_shutdown_write(smc); break; case SHUT_RD: - if (sk->sk_state == SMC_LISTEN) - rc = smc_close_active(smc); - else - rc = 0; - /* nothing more to do because peer is not involved */ + rc = 0; + /* nothing more to do because peer is not involved */ break; } - rc1 = kernel_sock_shutdown(smc->clcsock, how); + if (smc->clcsock) + rc1 = kernel_sock_shutdown(smc->clcsock, how); /* map sock_shutdown_cmd constants to sk_shutdown value range */ sk->sk_shutdown |= how + 1;