Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp666187pxb; Wed, 3 Nov 2021 10:18:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN58DJNefNYBAiY/OlYM4K727dNAHqShwGhfxHExAjcewzOSkpOeWHJk1wUPFXUf8xeFX7 X-Received: by 2002:a05:6e02:1c8a:: with SMTP id w10mr31881505ill.193.1635959888655; Wed, 03 Nov 2021 10:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635959888; cv=none; d=google.com; s=arc-20160816; b=tI/pMmh7JabmomHaWRsjIWcEqwvvxZA+WA76pQqEMUHL2jzxYKSIF4qW5dYRLv1Ckh hMI5lSG5ycq7jNy8MD3tc+zDKXdPB4GQz8kkzI20djjVapPGPd2m5X0gdoZS3Y49o0xe 1IN2Z06cb5YQlgweI6lmAm6yVB9lmBc9hFfnZ4+tZntQZWxlwcSLBZ94VXegeUmmMpxP xKktYavIL6Gs95dG43JGGnVdKxT2WNVfEDoV0CYeeQwTb2CTfLkqKSO+d0u4gpi3KFB5 IoOpoghCClw/uPTY1UnPV9psnPhBzwNTjPkXGqgyRNpsbeJ8Dx9CfeY27dH4EzZM2HBC ppPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bV161Tgs4wSnzMybCdsPXiLVkj0ud2/om2LUNqGC1RA=; b=iLh1ddmwky4ltG3LGYMsSHmguFJ1F3njjcXMv7wO+3mbnzKjR3QRp01WIHm+AZ5N2O 0cF8m774aFuNWOj0+FeJ6Z28ZpF/dkFNxCBCuluYwxaPz6c4jTqTVHy4X5rPe3TrIEiz EBE34ACustZjS0Afp5KC2U2+z9F+MvD+QyQSxwnXdb2BYLSyJkh1u4VUi9ScfP59JifM dNmS8bapBFEldGgQM3+zNg+8E+M0wXZEzlwSY8zpNW0V0wLwgY/Sdg4CHu3+bo1BUuKA IRqyx3tBEmNTLw9OlQ+fnCO9WxxlF8+vcFAepJN7/v+zVJf+ldy4AcrI8BF7mPkUTjlx PNhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZRMroyRI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p40si4451630jal.133.2021.11.03.10.17.55; Wed, 03 Nov 2021 10:18:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZRMroyRI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229885AbhKCRTg (ORCPT + 99 others); Wed, 3 Nov 2021 13:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbhKCRTf (ORCPT ); Wed, 3 Nov 2021 13:19:35 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8594EC061714 for ; Wed, 3 Nov 2021 10:16:58 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id h24so684369pjq.2 for ; Wed, 03 Nov 2021 10:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=bV161Tgs4wSnzMybCdsPXiLVkj0ud2/om2LUNqGC1RA=; b=ZRMroyRI+rPDWvePSSpTvBhiJsCJEQmo2gt/kDiy/MlSfUtg7NNa0p2QaZUikvBA0n zyFTTC2Qc1Z5Tzzn0Nluc1PqpAmhJf7FSULF8I+1qo+QgLQ8pAWGoxdz5CHT1yipbSan rH0pjlfV/T2v8996rQXxkGTZbPpNwpcuUpbek= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bV161Tgs4wSnzMybCdsPXiLVkj0ud2/om2LUNqGC1RA=; b=ds3vJo5FtN3AneNGn8AQqvFpp+0ayw3xtCxobOnN1NpnSeRNIWEx2mjxlNZ4+MiF63 uAVjeEOUlfoYnGFMEIalJzrj1SdGR5pYVK6lvu2DXRx1cKvtk+TNgKEBPmvUHgisVAbG o2mri5TlGNDh+kHC0UMeXphiQXJi9wYpkRFnahuTzn3bgiI7c+QW72jnG8N667gSvC68 tiEvJnfOnFNIDgQSO4l8Qb1zdzVwNQnnQkKsIQblGdSh3RyzBEgJcfMuhWisZRJMc60u OvzxQ2/GPHSUlPlyJc28PlavHCpcaIoDX2w0+KAwqIh8YoCtHPAh5QWialxxfeFDQeBg kNnQ== X-Gm-Message-State: AOAM532U/5uPwjaHijh62Y8a6ohC3UZN37CCut3KzVxtAPC3rgjWd8V+ 7e9+ykNJNwY5kzyvnLLKiaG+c0x7H8k7fw== X-Received: by 2002:a17:90a:c58d:: with SMTP id l13mr16185603pjt.189.1635959817332; Wed, 03 Nov 2021 10:16:57 -0700 (PDT) Received: from localhost ([2620:15c:202:201:b5cc:11fb:70c8:786f]) by smtp.gmail.com with UTF8SMTPSA id q1sm3256107pfu.44.2021.11.03.10.16.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Nov 2021 10:16:56 -0700 (PDT) Date: Wed, 3 Nov 2021 10:16:55 -0700 From: Matthias Kaehlcke To: Sujit Kautkar Cc: Andy Gross , Ohad Ben-Cohen , Bjorn Andersson , Sibi Sankar , Stephen Boyd , linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: Re: [PATCH v3 2/2] rpmsg: glink: Update cdev add/del API in rpmsg_ctrldev_release_device() Message-ID: References: <20211102235147.872921-1-sujitka@chromium.org> <20211102165137.v3.2.Ie09561c5b453a91f10ecc7e1974c602c4ff78245@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211102165137.v3.2.Ie09561c5b453a91f10ecc7e1974c602c4ff78245@changeid> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 02, 2021 at 04:51:51PM -0700, Sujit Kautkar wrote: > Replace cdev add/del APIs with cdev_device_add/cdev_device_del to avoid > below kernel warning. This correctly takes a reference to the parent > device so the parent will not get released until all references to the > cdev are released. > > | ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x7c > | WARNING: CPU: 7 PID: 19892 at lib/debugobjects.c:488 debug_print_object+0x13c/0x1b0 > | CPU: 7 PID: 19892 Comm: kworker/7:4 Tainted: G W 5.4.147-lockdep #1 > | ================================================================== > | Hardware name: Google CoachZ (rev1 - 2) with LTE (DT) > | Workqueue: events kobject_delayed_cleanup > | pstate: 60c00009 (nZCv daif +PAN +UAO) > | pc : debug_print_object+0x13c/0x1b0 > | lr : debug_print_object+0x13c/0x1b0 > | sp : ffffff83b2ec7970 > | x29: ffffff83b2ec7970 x28: dfffffd000000000 > | x27: ffffff83d674f000 x26: dfffffd000000000 > | x25: ffffffd06b8fa660 x24: dfffffd000000000 > | x23: 0000000000000000 x22: ffffffd06b7c5108 > | x21: ffffffd06d597860 x20: ffffffd06e2c21c0 > | x19: ffffffd06d5974c0 x18: 000000000001dad8 > | x17: 0000000000000000 x16: dfffffd000000000 > | BUG: KASAN: use-after-free in qcom_glink_rpdev_release+0x54/0x70 > | x15: ffffffffffffffff x14: 79616c6564203a74 > | x13: 0000000000000000 x12: 0000000000000080 > | Write of size 8 at addr ffffff83d95768d0 by task kworker/3:1/150 > | x11: 0000000000000001 x10: 0000000000000000 > | x9 : fc9e8edec0ad0300 x8 : fc9e8edec0ad0300 > | > | x7 : 0000000000000000 x6 : 0000000000000000 > | x5 : 0000000000000080 x4 : 0000000000000000 > | CPU: 3 PID: 150 Comm: kworker/3:1 Tainted: G W 5.4.147-lockdep #1 > | x3 : ffffffd06c149574 x2 : ffffff83f77f7498 > | x1 : ffffffd06d596f60 x0 : 0000000000000061 > | Hardware name: Google CoachZ (rev1 - 2) with LTE (DT) > | Call trace: > | debug_print_object+0x13c/0x1b0 > | Workqueue: events kobject_delayed_cleanup > | __debug_check_no_obj_freed+0x25c/0x3c0 > | debug_check_no_obj_freed+0x18/0x20 > | Call trace: > | slab_free_freelist_hook+0xb4/0x1bc > | kfree+0xe8/0x2d8 > | dump_backtrace+0x0/0x27c > | rpmsg_ctrldev_release_device+0x78/0xb8 > | device_release+0x68/0x14c > | show_stack+0x20/0x2c > | kobject_cleanup+0x12c/0x298 > | kobject_delayed_cleanup+0x10/0x18 > | dump_stack+0xe0/0x19c > | process_one_work+0x578/0x92c > | worker_thread+0x804/0xcf8 > | print_address_description+0x3c/0x4a8 > | kthread+0x2a8/0x314 > | ret_from_fork+0x10/0x18 > | __kasan_report+0x100/0x124 > > Signed-off-by: Sujit Kautkar Reviewed-by: Matthias Kaehlcke