Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3675457rwb; Tue, 8 Nov 2022 07:13:14 -0800 (PST) X-Google-Smtp-Source: AMsMyM6Lvzm26/PRDFqd/hhV5NfofINUPtXomY2oR1LtJio/uwGHqQgYAkFEPGqvNwEeyjaIa72c X-Received: by 2002:aa7:ca50:0:b0:461:9845:d9d2 with SMTP id j16-20020aa7ca50000000b004619845d9d2mr55624504edt.163.1667920394254; Tue, 08 Nov 2022 07:13:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667920394; cv=none; d=google.com; s=arc-20160816; b=rKr/xRiQE5iz+QZ+PXz2CsOuDz50JTmHiWPHo/5yrNFQGCEPt6XUBFBuoHEPJHzhDo BGonQj94AXDA8KACy7ZKlpdoj+SMAtIXDHQum7i3jeJBJP2pbytpvTb5oiUhwlu19K9I fpc2bQYfUfrwVVODuU2GaiU8B0OFm6rkFNjLg/PDAB0qWKHjLKkKROo8tEifNfdUCx+H LYAMs+Ufok3+kg/WFWTkSAUaVkdIJU73azNSRhbibAldg4YCPLPQTc095W+mMSRWz03K uyl3ITZOrcSqVaptVRq+pX9IwVACARGyO6FHyGLmsueAgrF52y3uKxFqIAWCrFflE5ii /Qug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=QF12oZt8AZ44/sdT+3QD1AGRv3vT5XnqG2NmIMvCMaw=; b=dhpMZRVOHYyGpGujJlpw4vdS6ChIf4azV7PHSwOHA0pSzjoQST2nwnkYMVkImWYB3O sEvkxAOjvIqK3+WPo08gk5CVqCn3nJDQZ1yGzf9FrCKcHy2RSzgHRgc/AhYsD2E2V5aQ bAuL69ZlTjh1zS3IQD7K2zNlugpwrPIfJ5NSw0PXkNA+INh5D66xWiMYl8IgVFkY90qG FBMEcKqzlY+AEMj8zKYZE1xkV9cpTlom57J6shVpvrQbjs9khYyM51f+WlSa9jCFygg7 iUwIoksZNETnaFhpd98vLYk7EvIEApZGhD5rm8nWed71Brt086QPJTPpUqktyzOdKtiJ 6teQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a056402359600b0045d27e4f95dsi14290331edc.334.2022.11.08.07.12.52; Tue, 08 Nov 2022 07:13:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234118AbiKHOy3 (ORCPT + 91 others); Tue, 8 Nov 2022 09:54:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234328AbiKHOyT (ORCPT ); Tue, 8 Nov 2022 09:54:19 -0500 Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 010FA43849; Tue, 8 Nov 2022 06:54:17 -0800 (PST) Received: by mail-qv1-f49.google.com with SMTP id x13so10366519qvn.6; Tue, 08 Nov 2022 06:54:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QF12oZt8AZ44/sdT+3QD1AGRv3vT5XnqG2NmIMvCMaw=; b=8Mob5Apdy2I0+S5WmtQGynQ2oQ2420U9zneAhvlJ+Q9He3aMpwgyu1nIwKU9QKAPXP ehr/BiWPi6FfaJupCo7vBSxa1ccpzTsHrJhNGUn5Ebd4hObOsu8TMRFyCmd+l1IteG6d owDax5cd9B+gWoaHkKz1WBEKs4zP3/S2H5ocTv8ROKomzZfAYX7a4T2fWVrt4cwEzKVl yUFlzHy0j6LwMUJpu23XpY6OuxZjI1YZ1dcKVvkvO8ZAbsDpj8coR9xS9+K050seldFC POSPyUB7MOzOgfYJZCe2VFcvT+8ym2oD4MwuTLzNtdc+XaSwGnCIVsr3nKwF00hWA/sN M49A== X-Gm-Message-State: ACrzQf1h/cIwFYQ4kh2QKTiOtnLrfyMkIp+Vt8uLYjnWhEWEAA7t13Eu aa4FJjWKMD/uM6J0seIWlyUuKGVE2GgT57cdIIc= X-Received: by 2002:a05:6214:f63:b0:4b8:c0bc:c43e with SMTP id iy3-20020a0562140f6300b004b8c0bcc43emr49934995qvb.119.1667919257095; Tue, 08 Nov 2022 06:54:17 -0800 (PST) MIME-Version: 1.0 References: <2276401.ElGaqSPkdT@kreacher> <2219830.iZASKD2KPV@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Tue, 8 Nov 2022 15:54:06 +0100 Message-ID: Subject: Re: [PATCH v1 5/5] rtc: rtc-cmos: Disable ACPI RTC event on removal To: Andy Shevchenko Cc: "Rafael J. Wysocki" , Alexandre Belloni , linux-rtc@vger.kernel.org, Linux ACPI , LKML , Linux PM , Zhang Rui , Alessandro Zummo Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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-kernel@vger.kernel.org On Mon, Nov 7, 2022 at 10:21 PM Andy Shevchenko wrote: > > On Mon, Nov 07, 2022 at 09:03:06PM +0100, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > Make cmos_do_remove() drop the ACPI RTC fixed event handler so as to > > prevent it from operating on stale data in case the event triggers > > after driver removal. > > > > While at it, make cmos_do_remove() also clear the driver data pointer > > of the device and make cmos_acpi_wake_setup() do that in the error path > > too. > > ... > > > + dev_set_drvdata(dev, NULL); > > > + dev_set_drvdata(dev, NULL); > > Maybe I'm missing something, but the cmos_do_remove() is called by ->remove() > callback of the real drivers (pnp and platform) and device core is already > doing this. So, don't know why you need these calls to be explicit. Good point, but then I guess I should move this patch to the front, because the issue fixed by it may trigger a use-after-free in rtc_handler() already.