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=-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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); }