Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp939769pxj; Fri, 21 May 2021 02:44:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOTSFcf3KrzLlqV8NqkEcVaztBuQTij/YiKSi4YbDajAZW8SNvqUjlX8+d4/wQe6SElV7a X-Received: by 2002:a17:907:10d8:: with SMTP id rv24mr9342214ejb.542.1621590256404; Fri, 21 May 2021 02:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621590256; cv=none; d=google.com; s=arc-20160816; b=DExsDcaz5qJa/99bi7r0TNUzue9hzQt4U/04j5LmDYHL9Fo2TupOebGxo/u3nUj50r +nJRrbdIdNhQPwXmbLB7HuSSArECGnTr/5W9lhvJsjqao38LZyylXOx3XrtI8SG3Tr5e /FLb4ZLy+AlXOyJckJSn7Nfl4kUAofCGlQXw1bHIpsmoSfakW3fJEJXcpPoGWTzUNV26 56bXmaFOf2YUwAR0GxQwXc8egz4pmXGrP5/yeq0OhnUZYUasaTexh9FR0WDfTpv3EaNT i+VRPNw00smveKLCu3rDX8Em3IiARDvuwygO4Gn4IbgXklkNSt2UTnsHx2I8XQyUDuLS WiUg== 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:dkim-signature; bh=/6OeTIPD5d8+6QhQeDTSSu4pXpzUgcgHUDk9Koberlc=; b=xjd1Rtr7V/a3q7z2MnaeOgAsGQQMKdqD98mC0KlleYu7H6Bj83nto4l59NxnOxK7Uc MCOV3NxM7QgJtSCjpRwoKSZrUHKEvl+fYAb1DkM1k4UX2b8BF9snIKjRUS759my0VX55 LKDGxZioTNXFxXNrH+vdzMqXlIMo2lAO8ferU9Pf2Uxk0JdZ6kn84N1l1m1uDqmGge95 KnaacLQWomVMyqcJUXG3yr0TtKWAbKNSGISTGfxWP2ixpUM3NSzvuHjZjQ8e8miDr886 Aso04tkuUoyYdwP7h9onLZ1cETOUbHu7IjTKidnSn49A75/NMWa3KqlkHAfE1j1svR9u Pcig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TQedDVNs; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rs28si5257521ejb.19.2021.05.21.02.43.53; Fri, 21 May 2021 02:44:16 -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=@gmail.com header.s=20161025 header.b=TQedDVNs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239428AbhEUFLa (ORCPT + 99 others); Fri, 21 May 2021 01:11:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239415AbhEUFLa (ORCPT ); Fri, 21 May 2021 01:11:30 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0F4BC061574; Thu, 20 May 2021 22:10:07 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id t24so3099942oiw.3; Thu, 20 May 2021 22:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/6OeTIPD5d8+6QhQeDTSSu4pXpzUgcgHUDk9Koberlc=; b=TQedDVNsFVntkEo6UHAGyWqOMGsGp+bIEzoxmBF33H6amp9RmsLn7EedixL/lv7RuL Pmb1N2OfeeM1ExO/Hh+Bi7U1F1nZiSJFg0GWhKBDd2r2cW6jLPObtYKw3X5QMMmAgfyP kldSf9aXASXFjsVglb9VNFhCyxG7nka6Hivuv5y063lDGgeTowkomoeXktlaa0/e6R2v i4LG8u8vJFHUWPf0Y+jKVyOkKXRPDN3G2t3OArGIJRUJr6vkhpLs7q4/4BifiCjE7x5f NcYNtYrqTGUc17lCVGKYaUcBRx9WT+DMLPEmlMLDYC4at0IH74QFO68N+rNHLS1MRF6p VU6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/6OeTIPD5d8+6QhQeDTSSu4pXpzUgcgHUDk9Koberlc=; b=Om8wAaqfdiyL2dNnwxxstflhyrtAG0fyJ06fjIiCt3u+FEt0N9WSE+mrQVq10LHWzH AiAyl+I8H4Qs07ODdWiG4WbnfcFNsNQEocmXmkpPH/IczxGcRj51u8NbvJfo7XhaCMNb 0dyhsDz42v8xq75JMu26pbmXQqsEJq3cA0UoQo7rSSSSGK3BqA4WQuE2lpzVbnKxSUCC no7+eMB8da4HqlEazNlLcCQ+WAgvCee/hYyP+xiq02whGjZSmIRQhZ9MBKsPnBod69iM XSAk56ArdU2iAjjptrGtwK/J6fkjI3ZbmqZ757Dd2oij6ajWt5izIqMgwYSKfMBF/Ivq k2OQ== X-Gm-Message-State: AOAM531PcgcbMeRm0WGNzMbq/8132oaeDKWetjdJ8ouLAiMqoMf8Axea i6RjgcJwXs+yv8x6T8Fz7h7jS4Ln5a+rxx8EXw== X-Received: by 2002:a54:4690:: with SMTP id k16mr790538oic.57.1621573807131; Thu, 20 May 2021 22:10:07 -0700 (PDT) MIME-Version: 1.0 References: <1620991027-25856-1-git-send-email-zheyuma97@gmail.com> In-Reply-To: From: Zheyu Ma Date: Fri, 21 May 2021 13:09:55 +0800 Message-ID: Subject: Re: [PATCH] serial: rp2: disable interrupt in rp2_probe(): To: Greg KH Cc: cernekee@gmail.com, jirislaby@kernel.org, linux-serial@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 20, 2021 at 10:30 PM Greg KH wrote: > > On Fri, May 14, 2021 at 11:17:07AM +0000, Zheyu Ma wrote: > > In 'rp2_probe', the driver registers 'rp2_uart_interrupt' then calls > > 'rp2_fw_cb' through 'request_firmware_nowait'. In 'rp2_fw_cb', if the > > firmware don't exists, function just return without initializing ports > > of 'rp2_card'. But now the interrupt handler function has been registered, > > and when an interrupt comes('rp2' may shares an interrupt line with other > > devices), 'rp2_uart_interrupt' may access those ports then causing NULL > > pointer dereference or other bugs. > > > > Fix this by disabling interrupt after registering 'rp2_uart_interrupt', > > and enable it in 'rp2_uart_startup'. > > What prevents an interrupt from coming in right after callin > rp2_uart_interrupt()? The driver has to be able to handle that. Why is > the interrupt being registered before the firmware is loaded? That > should be the proper fix as once you register an interrupt, the driver > HAS to be able to properly handle it. > > thanks, > > greg k-h Thanks for your comments, I will reconsider this patch and send the second version of the patch. Zheyu Ma