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=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 84134C3A59F for ; Thu, 29 Aug 2019 15:39:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DF6520828 for ; Thu, 29 Aug 2019 15:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727949AbfH2Pju (ORCPT ); Thu, 29 Aug 2019 11:39:50 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:50469 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727947AbfH2Pjt (ORCPT ); Thu, 29 Aug 2019 11:39:49 -0400 X-Originating-IP: 86.207.98.53 Received: from localhost (aclermont-ferrand-651-1-259-53.w86-207.abo.wanadoo.fr [86.207.98.53]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id E8D0E240007; Thu, 29 Aug 2019 15:39:47 +0000 (UTC) Date: Thu, 29 Aug 2019 17:39:42 +0200 From: Alexandre Belloni To: Anson.Huang@nxp.com Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, Linux-imx@nxp.com Subject: Re: [PATCH] rtc: snvs: fix possible race condition Message-ID: <20190829153942.GK21922@piout.net> References: <20190716071858.36750-1-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190716071858.36750-1-Anson.Huang@nxp.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org On 16/07/2019 15:18:58+0800, Anson.Huang@nxp.com wrote: > From: Anson Huang > > The RTC IRQ is requested before the struct rtc_device is allocated, > this may lead to a NULL pointer dereference in IRQ handler. > > To fix this issue, allocating the rtc_device struct before requesting > the RTC IRQ using devm_rtc_allocate_device, and use rtc_register_device > to register the RTC device. > > Signed-off-by: Anson Huang > --- > drivers/rtc/rtc-snvs.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > Applied, thanks. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com