From patchwork Thu Oct 15 12:59:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 11839307 X-Patchwork-Delegate: kuba@kernel.org 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.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham 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 7605CC43467 for ; Thu, 15 Oct 2020 12:59:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A84C22255 for ; Thu, 15 Oct 2020 12:59:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YbwbcwBO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728681AbgJOM7e (ORCPT ); Thu, 15 Oct 2020 08:59:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:40000 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727821AbgJOM7X (ORCPT ); Thu, 15 Oct 2020 08:59:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602766762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HedO1XyP/60FFHQo5ha5XlYFvUzHiIh1ZZJCehpSLMU=; b=YbwbcwBOmrFz20q8yImcGJx/57wCRW/vJAejo4TSuXthN9upgR3pkIVyTHg20wVZNkJyvL f/lHSFzKu0nt38xgXPNAdnH/8rjdjfBqo9u0BAPr303Y5H2nx6CmlcqIuvDmsKRyrYMAYT Kpoo1hT0qg2UjiKzjCy8YXiJcvWvUek= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-E4UFa3wuPduHMnM1d26CIA-1; Thu, 15 Oct 2020 08:59:21 -0400 X-MC-Unique: E4UFa3wuPduHMnM1d26CIA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 412A49CC04; Thu, 15 Oct 2020 12:59:20 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-70.rdu2.redhat.com [10.10.120.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EE9F78805; Thu, 15 Oct 2020 12:59:19 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH net-next 1/2] rxrpc: Fix bundle counting for exclusive connections From: David Howells To: netdev@vger.kernel.org Cc: dhowells@redhat.com, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Date: Thu, 15 Oct 2020 13:59:18 +0100 Message-ID: <160276675875.955243.10686915683052608791.stgit@warthog.procyon.org.uk> In-Reply-To: <160276675194.955243.3551319337030732277.stgit@warthog.procyon.org.uk> References: <160276675194.955243.3551319337030732277.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Fix rxrpc_unbundle_conn() to not drop the bundle usage count when cleaning up an exclusive connection. Based on the suggested fix from Hillf Danton. Fixes: 245500d853e9 ("rxrpc: Rewrite the client connection manager") Reported-by: syzbot+d57aaf84dd8a550e6d91@syzkaller.appspotmail.com Signed-off-by: David Howells cc: Hillf Danton --- net/rxrpc/conn_client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c index 78c845a4f1ad..5d9adfd4c84f 100644 --- a/net/rxrpc/conn_client.c +++ b/net/rxrpc/conn_client.c @@ -901,7 +901,7 @@ static void rxrpc_unbundle_conn(struct rxrpc_connection *conn) struct rxrpc_bundle *bundle = conn->bundle; struct rxrpc_local *local = bundle->params.local; unsigned int bindex; - bool need_drop = false; + bool need_drop = false, need_put = false; int i; _enter("C=%x", conn->debug_id); @@ -928,10 +928,11 @@ static void rxrpc_unbundle_conn(struct rxrpc_connection *conn) if (i == ARRAY_SIZE(bundle->conns) && !bundle->params.exclusive) { _debug("erase bundle"); rb_erase(&bundle->local_node, &local->client_bundles); + need_put = true; } spin_unlock(&local->client_bundles_lock); - if (i == ARRAY_SIZE(bundle->conns)) + if (need_put) rxrpc_put_bundle(bundle); } From patchwork Thu Oct 15 12:59:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 11839309 X-Patchwork-Delegate: kuba@kernel.org 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.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 44982C433DF for ; Thu, 15 Oct 2020 12:59:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBD2B22255 for ; Thu, 15 Oct 2020 12:59:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZN2r3B7b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728871AbgJOM7o (ORCPT ); Thu, 15 Oct 2020 08:59:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:55705 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728521AbgJOM7b (ORCPT ); Thu, 15 Oct 2020 08:59:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602766770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T4MhbWxh851cjV4nmGqRdUHVI6ShXZOWPssQHQbSmKQ=; b=ZN2r3B7b3JYkEht09uvfgaHJi0UdmUC2YsV7d4FxYYT5US9X68lWOgBa2vy2U9QRw5hwLH wDK+mQV9jfgB1QjeUhRYdK3PfK1RHgfr9F2n/b7NYrbgMdUeS8zd+Nhn4Ec0a7hvhpX3dc JVASjP5+qRpf9rYdFqhi2V4YQJ3eZWk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-324-4KXv7USjNPeodSz_7XQReg-1; Thu, 15 Oct 2020 08:59:28 -0400 X-MC-Unique: 4KXv7USjNPeodSz_7XQReg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0DBEBD68A1; Thu, 15 Oct 2020 12:59:27 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-70.rdu2.redhat.com [10.10.120.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D4AC5C22B; Thu, 15 Oct 2020 12:59:26 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH net-next 2/2] rxrpc: Fix loss of final ack on shutdown From: David Howells To: netdev@vger.kernel.org Cc: dhowells@redhat.com, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Date: Thu, 15 Oct 2020 13:59:25 +0100 Message-ID: <160276676546.955243.15747495003059936378.stgit@warthog.procyon.org.uk> In-Reply-To: <160276675194.955243.3551319337030732277.stgit@warthog.procyon.org.uk> References: <160276675194.955243.3551319337030732277.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Fix the loss of transmission of a call's final ack when a socket gets shut down. This means that the server will retransmit the last data packet or send a ping ack and then get an ICMP indicating the port got closed. The server will then view this as a failure. Fixes: 3136ef49a14c ("rxrpc: Delay terminal ACK transmission on a client call") Signed-off-by: David Howells --- net/rxrpc/ar-internal.h | 1 + net/rxrpc/conn_client.c | 3 +++ net/rxrpc/conn_event.c | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h index c9287b6551df..dce48162f6c2 100644 --- a/net/rxrpc/ar-internal.h +++ b/net/rxrpc/ar-internal.h @@ -831,6 +831,7 @@ void rxrpc_clean_up_local_conns(struct rxrpc_local *); * conn_event.c */ void rxrpc_process_connection(struct work_struct *); +void rxrpc_process_delayed_final_acks(struct rxrpc_connection *, bool); /* * conn_object.c diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c index 5d9adfd4c84f..7e574c75be8e 100644 --- a/net/rxrpc/conn_client.c +++ b/net/rxrpc/conn_client.c @@ -906,6 +906,9 @@ static void rxrpc_unbundle_conn(struct rxrpc_connection *conn) _enter("C=%x", conn->debug_id); + if (conn->flags & RXRPC_CONN_FINAL_ACK_MASK) + rxrpc_process_delayed_final_acks(conn, true); + spin_lock(&bundle->channel_lock); bindex = conn->bundle_shift / RXRPC_MAXCALLS; if (bundle->conns[bindex] == conn) { diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c index 6b7c6f4a82e3..aff184145ffa 100644 --- a/net/rxrpc/conn_event.c +++ b/net/rxrpc/conn_event.c @@ -397,7 +397,7 @@ static void rxrpc_secure_connection(struct rxrpc_connection *conn) /* * Process delayed final ACKs that we haven't subsumed into a subsequent call. */ -static void rxrpc_process_delayed_final_acks(struct rxrpc_connection *conn) +void rxrpc_process_delayed_final_acks(struct rxrpc_connection *conn, bool force) { unsigned long j = jiffies, next_j; unsigned int channel; @@ -416,7 +416,7 @@ static void rxrpc_process_delayed_final_acks(struct rxrpc_connection *conn) smp_rmb(); /* vs rxrpc_disconnect_client_call */ ack_at = READ_ONCE(chan->final_ack_at); - if (time_before(j, ack_at)) { + if (time_before(j, ack_at) && !force) { if (time_before(ack_at, next_j)) { next_j = ack_at; set = true; @@ -450,7 +450,7 @@ static void rxrpc_do_process_connection(struct rxrpc_connection *conn) /* Process delayed ACKs whose time has come. */ if (conn->flags & RXRPC_CONN_FINAL_ACK_MASK) - rxrpc_process_delayed_final_acks(conn); + rxrpc_process_delayed_final_acks(conn, false); /* go through the conn-level event packets, releasing the ref on this * connection that each one has when we've finished with it */