From patchwork Tue Dec 6 15:58:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 30393 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2904012wrr; Tue, 6 Dec 2022 08:02:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf57MX33zpM3uZ9a+bXnzVpNV67A5Hx0JNv0dZBlKFcI7y1H7e2YceGzQlv6yTXI41j8bFcE X-Received: by 2002:a63:ea17:0:b0:477:9a46:f57b with SMTP id c23-20020a63ea17000000b004779a46f57bmr62024668pgi.319.1670342561749; Tue, 06 Dec 2022 08:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670342561; cv=none; d=google.com; s=arc-20160816; b=elxC6amMepqrOignUKm46EbuN1ASpVdKeRXa9CL/q5hmnhX50x4FbIckzh+aCphlMT Q/smo0YzfRaFUwDOPlxrnEB41TXvH/ghcZ1s0EEzIFkPWXFynpMqH9yuvhoSVFcyjl/J /2DRMEEydCJb/D5bYRm8v8jeAbjNGeeBiNBLJZUbtIq/d9FzmxuWt0ciq3gY015Tucnc lXjaK7iuxidlJhDVuQ8HrbGNceeniR0y6YdS5MOIIdfmG3LP/Eyx5sYi8b+1opp96wuj ogYXHaE+N3y25zPHoLaxGGSF0CVWDFIGcPNu/L3ggJhJa6jp45qgJmM7PCfOq/vQem0Q ESVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:dkim-signature; bh=N+5b28BJJxQmQyCpULMzJ49e2Q4m0GQ5fyZzjgtDMp4=; b=qt0w8jmYfH7nB4QuJ2R+ms7JXpGGXtSVpAfTVtkeD2ZA/n/p1SKiMNe1GGP1oyHZy4 MZ3C3dPkxcAEziJeM73ng3tCjjlFVpkdZWMWE4tScxOJzdXDPCPfSkGdZLEIPPoOpWxV sV/FixhvsP1OIhnkPHPLsQYveTgI5fOzUbIpAav8DCfusur09biZSkzlmdViilsggkLD vldY2PnGSmzfxerA72rxBozxnT3euTqWdm177pJpBgXFecFDXnGVpzTVQzJd+UK2L1M0 opfe1D9R3FDf6ftpXL+AaR/AFPd5WvHI+5BdARHdz39MoA+SSc3kReeBuTd+iaVT5SnV tvVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bQ1MgE2y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a63610a000000b00478e15039c0si2111036pgb.779.2022.12.06.08.02.26; Tue, 06 Dec 2022 08:02:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bQ1MgE2y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235088AbiLFQAJ (ORCPT + 99 others); Tue, 6 Dec 2022 11:00:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231363AbiLFP77 (ORCPT ); Tue, 6 Dec 2022 10:59:59 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13AA1248E1 for ; Tue, 6 Dec 2022 07:59:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670342339; 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=N+5b28BJJxQmQyCpULMzJ49e2Q4m0GQ5fyZzjgtDMp4=; b=bQ1MgE2yoWIZTKJivD7peQdHneQAuqYNLPxVCbKqX/asul5y1nfGan483/LM+GtqKYw3yW ePOdT5XISzOZk34YQEh2DWuyIELjWKiU06xFYpUt+bkGLSsfYNLr+NpN4VKGQBhLyCy76B aivBEMV/CFJMAyfFVplSe7rL+J8LNgQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-335-QttAg9naOxSusdgBcSpC2g-1; Tue, 06 Dec 2022 10:58:48 -0500 X-MC-Unique: QttAg9naOxSusdgBcSpC2g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 24E95800159; Tue, 6 Dec 2022 15:58:48 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F2F940C6EC4; Tue, 6 Dec 2022 15:58:47 +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 01/32] rxrpc: Fix missing unlock in rxrpc_do_sendmsg() From: David Howells To: netdev@vger.kernel.org Cc: Marc Dionne , linux-afs@lists.infradead.org, dhowells@redhat.com, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Date: Tue, 06 Dec 2022 15:58:44 +0000 Message-ID: <167034232478.1105287.13584934117599532331.stgit@warthog.procyon.org.uk> In-Reply-To: <167034231605.1105287.1693064952174322878.stgit@warthog.procyon.org.uk> References: <167034231605.1105287.1693064952174322878.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.5 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751481122011650059?= X-GMAIL-MSGID: =?utf-8?q?1751481122011650059?= One of the error paths in rxrpc_do_sendmsg() doesn't unlock the the call mutex before returning. Fix it to do this. Note that this still doesn't get rid of the checker warning: ../net/rxrpc/sendmsg.c:617:5: warning: context imbalance in 'rxrpc_do_sendmsg' - wrong count at exit I think the interplay between the socket lock and the call's user_mutex may be too complicated for checker to analyse, especially as rxrpc_new_client_call_for_sendmsg(), which it calls, returns with the call's user_mutex if successful but unconditionally drops the socket lock. Fixes: e754eba685aa ("rxrpc: Provide a cmsg to specify the amount of Tx data for a call") Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- net/rxrpc/sendmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c index 9fa7e37f7155..cde1e65f16b4 100644 --- a/net/rxrpc/sendmsg.c +++ b/net/rxrpc/sendmsg.c @@ -625,7 +625,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len) if (call->tx_total_len != -1 || call->tx_pending || call->tx_top != 0) - goto error_put; + goto out_put_unlock; call->tx_total_len = p.call.tx_total_len; } }