Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1270667pxx; Fri, 30 Oct 2020 06:22:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNvXdL/DzUpnRGCK7sBb7Y93Ykem8jfuGz36cDSQJjIkMvXPqyHgZ7kh97plcGgtM4PZ+M X-Received: by 2002:a17:906:d78b:: with SMTP id pj11mr991273ejb.423.1604064148745; Fri, 30 Oct 2020 06:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604064148; cv=none; d=google.com; s=arc-20160816; b=bDLU0oi6mpGcg6imowvJgvcTxKuGWdY3UsVtvbzpoqRra5wtpNLjqjMC87TLcsdaPy KdDoEpjPch6/pADRwTS1N5PTFCzEFM/JcdS90Jx+543T8Ny7sDMWBO+x4pet8OTZf+SH XQCAep9SNnOmAG1qSW80KhCYvBX+NilTLk+5MRuAhdqXC6Eu0+mP2d+4SZod2MUYvrfF X2MWPsBdLk0BC3p6TjXIRwxAsmavMTQGqpGfwjVgi8A0sObBt3uWChP554GvwkcoTs/O askRNsvHS8b1NpaW02idnx3mCMzhUkrCHOJEDNZHaLxcrCaomeBPDR3V3NwlipN2PKpw stXA== 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=xFyS46X9kh1NWbr14wv/nJDNDTn+YMS1XnTi/wd21tc=; b=rpsIFV+pEFEOyQsaWa164NL7YCU9IOljstAIwJo9o5YaLtJ9OM4w8aOMDtI8jYwPRh BmXVx3eybb74h3XBbANPhztFQh0XZhLvdRhomYZMANS56aH2jh5z4JIyL5nnSoWZoka2 A7woBS+v7CTmIUKNSvaHDgccO9pDz5nAstw4IkAJ0cgC78u43zlkGyHKcGY17MK+zf5e px3gEBCN+ed4k98AJrKS/9qY2DgCGAdmmLmd0+DKSWwGNBaaHg/ycO6MbI0ke7YRctWC 278879+rsthXNcCOHjZFRgwydqeXapZ1q+lB6cNJzQ05xvwTJsWjqM4wDnB8UQ5SIf9g t59A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P+FmJ20Y; 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 h10si4694278edn.193.2020.10.30.06.22.05; Fri, 30 Oct 2020 06:22:28 -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=P+FmJ20Y; 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 S1726596AbgJ3NSc (ORCPT + 99 others); Fri, 30 Oct 2020 09:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbgJ3NSb (ORCPT ); Fri, 30 Oct 2020 09:18:31 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F5C8C0613CF; Fri, 30 Oct 2020 06:18:31 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id g25so5788012edm.6; Fri, 30 Oct 2020 06:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xFyS46X9kh1NWbr14wv/nJDNDTn+YMS1XnTi/wd21tc=; b=P+FmJ20YVKNwOxLSH405xuHUQaKuOy3JPZkJ7knoWdc55cdKPkQ2m/yQqqShC245wH ai0bz3nN+wWVhmf8cMdIRvuVuE/BXlu0kgSoXAF7pmSiSICz3rFHlW3+HH4jD02mYBbt t30FTHlCL2a4us/STblZUIBre43bprKuqp4TmCl3gl5eiZCW5LAT483JZUFnGEZcMwiM QePOFv41wS7f+9R4wAfYkQHUf+JbmthKm0ZQ0grFfw9KkVsHyoB0kjTvgMoNezuWix2G vzZwDDVZhBVz7oHMhmAFfdeYUzw+rbI/xWkkuDFE+JEObVzlBnH/vIKEx8qo5hf3ToaT kSPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xFyS46X9kh1NWbr14wv/nJDNDTn+YMS1XnTi/wd21tc=; b=owIqR+gJ91fFno+KqijaM/fCt5clFmFHofObTtdWFPTOOIkwh8V6UWbID7osFmFcgy zNMMVpL3B+8efz5FAvEA5kR1gjDDTJCLpsDKt6mL825Qzu7fX2cBXn/b14qmCcBucBYm TNNE88J95GOTRd4ZGH0udcxojIDOmyfZSiQ4dlRQwyBtEjO7/f9TWkXmjwdIVqFvXcDu dTq5cYTxVsnqpjOpw4WN7F+b6ubzEZZ2tn5J57WufEZjTMdWbA0HPK4+Lzyq9irZpKNz osn+mSUZwnMBeLZ4IYF6mVJDClWbxelYQ+oKmJ2i4o7pkTpul5B/xbPLP8G7+Cb9y1wk u/hw== X-Gm-Message-State: AOAM530QsPwV4myB64smm/E6oLRQmVdXGQ54ExIlKSkn2V3hIm1v8+Ky jUldFq3VnUYNO/vrGJQ5KV4= X-Received: by 2002:a50:9e29:: with SMTP id z38mr2358139ede.220.1604063910134; Fri, 30 Oct 2020 06:18:30 -0700 (PDT) Received: from skbuf ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id c17sm3114223edv.19.2020.10.30.06.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 06:18:29 -0700 (PDT) Date: Fri, 30 Oct 2020 15:18:28 +0200 From: Vladimir Oltean To: Qiang Zhao Cc: broonie@kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] spi: fsl-dspi: fix NULL pointer dereference Message-ID: <20201030131828.7h25eps7wuf655eh@skbuf> References: <20201029084035.19604-1-qiang.zhao@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201029084035.19604-1-qiang.zhao@nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 04:40:35PM +0800, Qiang Zhao wrote: > From: Zhao Qiang > > Since commit 530b5affc675 ("spi: fsl-dspi: fix use-after-free in > remove path"), this driver causes a kernel oops: > > [ 64.587431] Unable to handle kernel NULL pointer dereference at > virtual address 0000000000000020 > [..] > [ 64.756080] Call trace: > [ 64.758526] dspi_suspend+0x30/0x78 > [ 64.762012] platform_pm_suspend+0x28/0x70 > [ 64.766107] dpm_run_callback.isra.19+0x24/0x70 > [ 64.770635] __device_suspend+0xf4/0x2f0 > [ 64.774553] dpm_suspend+0xec/0x1e0 > [ 64.778036] dpm_suspend_start+0x80/0xa0 > [ 64.781957] suspend_devices_and_enter+0x118/0x4f0 > [ 64.786743] pm_suspend+0x1e0/0x260 > [ 64.790227] state_store+0x8c/0x118 > [ 64.793712] kobj_attr_store+0x18/0x30 > [ 64.797459] sysfs_kf_write+0x40/0x58 > [ 64.801118] kernfs_fop_write+0x148/0x240 > [ 64.805126] vfs_write+0xc0/0x230 > [ 64.808436] ksys_write+0x6c/0x100 > [ 64.811833] __arm64_sys_write+0x1c/0x28 > [ 64.815753] el0_svc_common.constprop.3+0x68/0x170 > [ 64.820541] do_el0_svc+0x24/0x90 > [ 64.823853] el0_sync_handler+0x118/0x168 > [ 64.827858] el0_sync+0x158/0x180 > > This is because since this commit, the drivers private data point to > "dspi" instead of "ctlr", the codes in suspend and resume func were > not modified correspondly. > > Fixes: 530b5affc675 ("spi: fsl-dspi: fix use-after-free in remove path") > Signed-off-by: Zhao Qiang > --- Reviewed-by: Vladimir Oltean Please resend with Mark's comment. I would prefer that you even remove the stack trace completely and make it more obvious in the commit message itself that the NULL pointer occurs during suspend/resume. Somehow that managed to get obscured in your current version. It is also not helpful at all that there already exists a commit titled 'spi: fsl-dspi: fix NULL pointer dereference' on this driver. This causes confusion for backporters. Please provide a unique commit message. Thanks.