Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1369148iog; Tue, 14 Jun 2022 04:55:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sTa3JMIsPK2fPeWu4r3EH4SMmNxsMSMoKXhN4pH5nHEdKVFbromwVtzqkVaUvg763vgj+d X-Received: by 2002:a17:906:1c4e:b0:707:959:8cfd with SMTP id l14-20020a1709061c4e00b0070709598cfdmr4096645ejg.738.1655207753625; Tue, 14 Jun 2022 04:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655207753; cv=none; d=google.com; s=arc-20160816; b=OsrojN107fEbMX5oyJgwshueV7cN0tvCMSyPds96Y/0y40nTD0fSIA7i5eoYQw0ky0 Gd7CXp8CT7Y/kO3ex4jN20obTaZHtJXtMpaE+qw4gw71m4tfLhFa30eS+uv32zZLrhER /dxErIsjawHIWso0lDAnUvEjxjbdM46ssZKyi2wzrJQyNTGLIJ9AKvBotFuCiXdBNIV+ stEp+jow9kFJbeAEiJhde2JztRTXmbjZGYlnnygrmAij+b+2UL4TR8PYheZylPkjitk7 MsmdMlGxHRzaDohvLv4S6EcEQrUnV+BuJs7hmRxKrcZHfp/SVf51x1jqxZLWsUDLPLun gSoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=oJaoP1q9f4BLlEFP5L2kurHJ7wFO5mCxlrOP8CqFxr0=; b=nGV43p/ASTy/TibQ4fh4F4AFyF8r7JdKQdnOSxxrqcBgIYf8VkSi86Ph0pi+E+Dv2W BLHWXVfPeZKEUFocXbgpAS5U357gg2S7tSF5103TrpJPsFtlZp5LprfwT0Ynxb2cU0wn kUG+HENaIAO0/wQbZ3bxb/Qdrfksl7nGfjeZWEFAzOG0SWP4kMF3sA/Jfz1tcY0fyvyD A1iep8S2lI+SbQ6AMTS1BrUuY50dNvafPRGAgH9gAMn1+XNXYXDidao8yMrhcoPde2Ip 2HF6X8CE8G6+kJ0vdbLKP1F6Hjo6M685ORvE6A6D+PlvX1SUnoThY75N/yoARlTOPlAO uNyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a056402280600b00434dcb3190csi9534810ede.585.2022.06.14.04.55.08; Tue, 14 Jun 2022 04:55:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239698AbiFNLtf (ORCPT + 99 others); Tue, 14 Jun 2022 07:49:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242858AbiFNLtf (ORCPT ); Tue, 14 Jun 2022 07:49:35 -0400 X-Greylist: delayed 87941 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 14 Jun 2022 04:49:29 PDT Received: from smtpbgeu1.qq.com (smtpbgeu1.qq.com [52.59.177.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93BF8340FF for ; Tue, 14 Jun 2022 04:49:29 -0700 (PDT) X-QQ-mid: bizesmtp71t1655207363tl1pkr59 Received: from localhost.localdomain ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 14 Jun 2022 19:49:17 +0800 (CST) X-QQ-SSF: 01400000002000C0D000B00A0000000 X-QQ-FEAT: T/61Y8rdSIt9rUqv+Wg5aQQSsWs3GtE7InD7BiTZ8lpXwGhbMijkggiTNwDBV 7vj4nVj1asYSHYe+ScjHM0y3fuMClxOI0kYLwR3MS9RD8hV1EL5/+hVT5wsmAQSFl28raP4 1wYomWveEksQCu/neZHyXoPWEOTJmC+A91rgdbfY53Ra1WwJp/eoGDiTWFP58prw+ZlXen5 u6G11q4pink5pSf7ZhSVM048BYCesZ+c3BaK80jzzzvqpSUPMemljfpdkvEH0YOHT8rpBWp 1oGLRyIUffV1ogN2ftYx8URCUT+PqVOmIzkhDY6IzzKfQBoBuJrltqYbrMw7Dp2gWnGs9t5 0Hw9b3F X-QQ-GoodBg: 2 From: wangyouwan To: linux-bluetooth@vger.kernel.org Cc: wangyouwan Subject: [PATCH] obexd: Fix transfer has been free during transfer_abort_response func Date: Tue, 14 Jun 2022 19:49:14 +0800 Message-Id: <20220614114914.30497-1-wangyouwan@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign4 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_PASS,T_SCC_BODY_TEXT_LINE,T_SPF_HELO_TEMPERROR 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-bluetooth@vger.kernel.org Breakpoint 7, transfer_new (obex=0x5555555f5b50, opcode=2 '\002', complete_func=0x555555590c40 , user_data=0x5555555f7000) at gobex/gobex-transfer.c:254 254 gobex/gobex-transfer.c: (gdb) c Continuing. Breakpoint 3, transfer_complete (transfer=0x5555555f5f40, err=0x5555555f6d60) at gobex/gobex-transfer.c:99 99 in gobex/gobex-transfer.c (gdb) c Continuing. Breakpoint 4, xfer_complete (obex=0x5555555f5b50, err=0x5555555f6d60, user_data=0x5555555f7000) at obexd/client/transfer.c:659 659 obexd/client/transfer.c: (gdb) n 661 in obexd/client/transfer.c (gdb) n 663 in obexd/client/transfer.c (gdb) p callback->func $17 = (transfer_callback_t) 0x5555555885e0 (gdb) c Continuing. Breakpoint 3, transfer_complete (transfer=0x5555555f7000, err=0x5555555f6d60, user_data=0x5555555f48d0) at obexd/client/session.c:964 964 obexd/client/session.c: (gdb) c Continuing. Breakpoint 5, transfer_free (transfer=0x5555555f5f40) at gobex/gobex-transfer.c:61 61 gobex/gobex-transfer.c: (gdb) n 63 in gobex/gobex-transfer.c (gdb) p transfer->id $18 = 1 (gdb) c Continuing. Breakpoint 2, transfer_abort_response (obex=0x5555555f5b50, err=0x0, rsp=0x5555555f0810, user_data=0x5555555f5f40) at gobex/gobex-transfer.c:116 116 in gobex/gobex-transfer.c (gdb) n 118 in gobex/gobex-transfer.c (gdb) p transfer->id $19 = 1432314080 (gdb) c Continuing. Breakpoint 3, transfer_complete (transfer=0x5555555f5f40, err=0x5555555f6f00) at gobex/gobex-transfer.c:99 99 in gobex/gobex-transfer.c (gdb) c Continuing. Breakpoint 4, xfer_complete (obex=0x5555555f5b50, err=0x5555555f6f00, user_data=0x5555555f7000) at obexd/client/transfer.c:659 659 obexd/client/transfer.c: (gdb) n 661 in obexd/client/transfer.c (gdb) p callback->func $20 = (transfer_callback_t) 0x5555555f6420 (gdb) n 663 in obexd/client/transfer.c (gdb) n 668 in obexd/client/transfer.c (gdb) n 671 in obexd/client/transfer.c (gdb) n 672 in obexd/client/transfer.c (gdb) n 676 in obexd/client/transfer.c (gdb) n 679 in obexd/client/transfer.c (gdb) n 680 in obexd/client/transfer.c (gdb) n 0x00005555555f6420 in ?? () (gdb) n Cannot find bounds of current function (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0x00005555555f6420 in ?? () (gdb) --- gobex/gobex-transfer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gobex/gobex-transfer.c b/gobex/gobex-transfer.c index c94d018b2..48b1f6962 100644 --- a/gobex/gobex-transfer.c +++ b/gobex/gobex-transfer.c @@ -92,7 +92,9 @@ static void transfer_complete(struct transfer *transfer, GError *err) g_obex_drop_tx_queue(transfer->obex); } - transfer->complete_func(transfer->obex, err, transfer->user_data); + if (find_transfer(id) != NULL) + transfer->complete_func(transfer->obex, err, transfer->user_data); + /* Check if the complete_func removed the transfer */ if (find_transfer(id) == NULL) return; -- 2.20.1