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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 097CAC433FE for ; Wed, 23 Nov 2022 09:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237151AbiKWJKD (ORCPT ); Wed, 23 Nov 2022 04:10:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237169AbiKWJKA (ORCPT ); Wed, 23 Nov 2022 04:10:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BCA8102E49 for ; Wed, 23 Nov 2022 01:09:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AAF35B81EF2 for ; Wed, 23 Nov 2022 09:09:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9AD6C433D6; Wed, 23 Nov 2022 09:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669194596; bh=dU0YEan+Dq5IMX06acglBjNA8ZbiM1WnuT3kY3iI5PQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GwzOrz4WoDaPYysf9TRoYUI7h7VDuiSzFy4uuVzCobOCLm++QF7BKfJNTqDgQ+8dz 7DjMdYxJUZxBf1hTtXbxM1qyLFfD6PM62jRv/igJ1WSTmdvB4cULYPZSZTgE/TIZ56 1/+r47qhAkk1Cqj0P4+2qU3k2XjWCasjRV9+AFo8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+50f7e8d06c3768dd97f3@syzkaller.appspotmail.com, Dominique Martinet , Schspa Shi Subject: [PATCH 4.19 107/114] 9p: trans_fd/p9_conn_cancel: drop client lock earlier Date: Wed, 23 Nov 2022 09:51:34 +0100 Message-Id: <20221123084555.976383490@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123084551.864610302@linuxfoundation.org> References: <20221123084551.864610302@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dominique Martinet commit 52f1c45dde9136f964d63a77d19826c8a74e2c7f upstream. syzbot reported a double-lock here and we no longer need this lock after requests have been moved off to local list: just drop the lock earlier. Link: https://lkml.kernel.org/r/20220904064028.1305220-1-asmadeus@codewreck.org Reported-by: syzbot+50f7e8d06c3768dd97f3@syzkaller.appspotmail.com Signed-off-by: Dominique Martinet Tested-by: Schspa Shi Signed-off-by: Greg Kroah-Hartman --- net/9p/trans_fd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -220,6 +220,8 @@ static void p9_conn_cancel(struct p9_con list_move(&req->req_list, &cancel_list); } + spin_unlock(&m->client->lock); + list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) { p9_debug(P9_DEBUG_ERROR, "call back req %p\n", req); list_del(&req->req_list); @@ -227,7 +229,6 @@ static void p9_conn_cancel(struct p9_con req->t_err = err; p9_client_cb(m->client, req, REQ_STATUS_ERROR); } - spin_unlock(&m->client->lock); } static __poll_t