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=-11.1 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,SPF_HELO_NONE,SPF_PASS 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 05900C433EF for ; Fri, 10 Sep 2021 07:05:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D930F610A3 for ; Fri, 10 Sep 2021 07:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbhIJHGA (ORCPT ); Fri, 10 Sep 2021 03:06:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231223AbhIJHF6 (ORCPT ); Fri, 10 Sep 2021 03:05:58 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4B47C061574 for ; Fri, 10 Sep 2021 00:04:47 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id lc21so2228990ejc.7 for ; Fri, 10 Sep 2021 00:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3H4oKYSFY56M3qiNXBl+wyXrV3Q3fK7XNGLdUGoxRYk=; b=XEF2dNRdTYcFZ49M5pLnNkQGCRME+D2yb6K0sa6lGGehvguZSeR4VYKb/SB8dsl55o MlQTLsfMEN8dRH9TY0LM2p/S2GDgMWhlby19cOyAfHiNLd7xfwmOpibfUxAIpxDDSWVk LfuzFhM/z4WSSobVjz8ZB+zSRJ86BWQd2cxWo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3H4oKYSFY56M3qiNXBl+wyXrV3Q3fK7XNGLdUGoxRYk=; b=y/dOvVLcACKd4m8Pm1FBIiMGf+iNFYA0GczCT8M9y3+jsoyM0a+YIZRah9vxZH6Anu YMFGU9sXr+uVsm7F7OR0TryHJF6SJP8PwZHk5Ltyru6nyTtsoiKYNZD6YynaRYIy7b3A 1Sz8gd9/gXIxyEyTr3hx5YLgfxEwIboSGs8wCsH8Oe9+tLJUku9RfMLIuXeQDtdBjjix QK4fPge1Gagutr1JEMD/zKcF1VHjVtf4ibK6BX9Khays9yuJRpGZMK8iiCIovRPE2cFz mmQyF9o3m5uxT51o76C9itt9WpSwO2wN3AN6VAI9TGBMGFCI8buzGfiW8Pn04jmq7kSi Bh+Q== X-Gm-Message-State: AOAM531v0MrBo1o8AoP+BhQ6PSmxUaklWEhl2l+EsznQe9BXJBAswwJn BnDVmKypPXuLiLTKV+o1cMEvWytt7xieU3qnhW7l1Q== X-Google-Smtp-Source: ABdhPJzdvpHts5YmnwO9zUbLdQPaUX6UVtZstq71FhyxXpicJP5fSXyIB9Z/lapxzFeS24WqtJwASK/He71YVJeakGo= X-Received: by 2002:a17:906:180a:: with SMTP id v10mr8039021eje.112.1631257486397; Fri, 10 Sep 2021 00:04:46 -0700 (PDT) MIME-Version: 1.0 References: <20210909232141.2489691-1-dualli@chromium.org> <20210909232141.2489691-2-dualli@chromium.org> <20210910060251.GC7203@kadam> In-Reply-To: <20210910060251.GC7203@kadam> From: Li Li Date: Fri, 10 Sep 2021 00:04:35 -0700 Message-ID: Subject: Re: [PATCH v1 1/1] binder: fix freeze race To: Dan Carpenter Cc: Li Li , Todd Kjos , Greg KH , Christian Brauner , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , "open list:ANDROID DRIVERS" , LKML , Martijn Coenen , Hridya Valsaraju , Suren Baghdasaryan , "Joel Fernandes (Google)" , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 9, 2021 at 11:03 PM Dan Carpenter wrote: > > On Thu, Sep 09, 2021 at 04:21:41PM -0700, Li Li wrote: > > @@ -4648,6 +4647,22 @@ static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, > > return 0; > > } > > > > +static int binder_txns_pending(struct binder_proc *proc) > > +{ > > + struct rb_node *n; > > + struct binder_thread *thread; > > + > > + if (proc->outstanding_txns > 0) > > + return 1; > > Make this function bool. Will include the change (as well as the extra ->outstanding_txns check) in the next revision. > > > + > > + for (n = rb_first(&proc->threads); n; n = rb_next(n)) { > > + thread = rb_entry(n, struct binder_thread, rb_node); > > + if (thread->transaction_stack) > > + return 1; > > + } > > + return 0; > > +} > > + > > static int binder_ioctl_freeze(struct binder_freeze_info *info, > > struct binder_proc *target_proc) > > { > > @@ -4682,6 +4697,14 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, > > if (!ret && target_proc->outstanding_txns) > > ret = -EAGAIN; > > These two lines can be deleted now because binder_txns_pending() checks > ->outstanding_txns. > Thanks, Li