Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp471973iog; Mon, 13 Jun 2022 06:36:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQcAf0Twc/RCucJcZEcd/tqckf/a2kZvzasp8GhP2D6E2qn1zN64mxFqfAH0+FeuYDmZmw X-Received: by 2002:a63:90c8:0:b0:3fc:ad6f:6e96 with SMTP id a191-20020a6390c8000000b003fcad6f6e96mr52342923pge.256.1655127393899; Mon, 13 Jun 2022 06:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655127393; cv=none; d=google.com; s=arc-20160816; b=IszxmvHPQ4+HVpc3zyv728Sj/NzUjs36NvnRtF4trnr/qnQAenSCkofRqo5/9XU5aQ tu2a79N6TUG/Fj9xB0BpyY6JyjbUxPBh9Cs+P7nHspclq7zRJBQwVskvhYdKxV3ylXuq 7wWdpwBWgj9k3/M124pCHT+jUtUqYdYCBc7Y3ojwyxtrT8avJJiweV6qAiL0LG0RzAMX DSloy3iIQWf/QXbKbc6EtZVQ6OlFh+XiKYANkfozgEFQ4Ve9CP0OO9O/PZprZK4Y+u4D 5KchdPfq+Wygfmimtf/BqJ/gob8+NHS0x+aD7Qrz4LK4EYVNF6Rta7GTGD1O8jgtTztz QUEg== 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=tvmyq1WPkxAXaCKyXy6LjH270FJJ8Zdz3qWXIAF7USM=; b=bYXOiYGRZ9TW1tfuwd1Uk1e/Ta5WCC7Gknzx3PN0dhTLGTjMSk+VjgqSErOss3fN55 ZJmD10VYkhft+VASClEmwDnkwmXzQnQdV34aYTiK1Lwwax3uOtyCcIuDdRpUmqKRDbOK sCZIy/ON01bcWps7u4L0EAmiXcF1EoSFbAbsjU/H87k1/1PrferEp7sHCPt+62ygHLxZ pCVOOp5mTbBYzjDiGTU8r/RAIJNkQe8hNVUCeNP2hwIqvAHJs7tCqBKxIdAisw6CAj1m v8zYe/hLBwvW7GjoMEC0bzNVmMdsuEzcwDRy5PoIoNBpuKeLPiclRXPEOkBCp1gEW3be C/hQ== 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 t190-20020a6381c7000000b0039cef73106esi10007305pgd.511.2022.06.13.06.36.03; Mon, 13 Jun 2022 06:36:33 -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 S1376319AbiFMNYy (ORCPT + 99 others); Mon, 13 Jun 2022 09:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377052AbiFMNYO (ORCPT ); Mon, 13 Jun 2022 09:24:14 -0400 Received: from smtpproxy21.qq.com (smtpbg701.qq.com [203.205.195.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF8A56B7EB for ; Mon, 13 Jun 2022 04:23:56 -0700 (PDT) X-QQ-mid: bizesmtp87t1655119399trh68o5p Received: from localhost.localdomain ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 13 Jun 2022 19:22:47 +0800 (CST) X-QQ-SSF: 00400000002000C0D000B00A0000000 X-QQ-FEAT: 8nRPapzIrE2CE+SmV7HzIOTRIYAAjjVJutUwegxmRc2aIU9K4oPj7AhQOv5aT NQDwV6RPlkHMLkJ1jJNd3T2rx67KQzAA2pXD+OCkdjQZgSgy4MFhHYTvQchvoOhxNXt8EeI ChXhwOa1MeI4QjblPxdhRoyomMx+Vj+I13F+LXjajzBITBO6R9A8J9lMR1XYcpiiyX4T5FI adJ30u1CI0TY3eiwe4Uuy65txBBvKJNdRwvbeHbaadf1WUpSHXXBHorsIXkKe9sKHMSl7dl 0a5m6MsCqhV9Cw/qT536jffoUKZ+bieGD+abOgA/14jOZSa/CTEZLhZSkbTg9YWxCAF+sQ1 G8SIB1K X-QQ-GoodBg: 2 From: wangyouwan To: linux-bluetooth@vger.kernel.org Cc: wangyouwan Subject: [PATCH] obexd: Fix callback->func =! NULL in the xfer_complete() func Date: Mon, 13 Jun 2022 19:22:42 +0800 Message-Id: <20220613112242.9407-1-wangyouwan@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 xfer_complete (obex=0x557d242c8cf0, err=0x557d242ca470, user_data=0x557d242ca300) 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 $1 = (transfer_callback_t) 0x0 (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 677 in obexd/client/transfer.c (gdb) n 0x0000000000000000 in ?? () (gdb) s Cannot find bounds of current function (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. --- obexd/client/transfer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c index dccce03b4..a7a85a0c0 100644 --- a/obexd/client/transfer.c +++ b/obexd/client/transfer.c @@ -666,7 +666,10 @@ static void xfer_complete(GObex *obex, GError *err, gpointer user_data) else transfer_set_status(transfer, TRANSFER_STATUS_COMPLETE); - if (callback) + if (callback == NULL) + return; + + if (callback->func) callback->func(transfer, err, callback->data); } -- 2.20.1