From patchwork Thu May 23 19:06:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 165057 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2621670ili; Thu, 23 May 2019 12:28:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqweTwp6rrlOTKHSWn/TqPpQHKtaqTO+5M/TwtsyK02EekWXO5vbl0ympnW/WFdEkczjWK43 X-Received: by 2002:a17:90a:d98d:: with SMTP id d13mr3608883pjv.64.1558639713009; Thu, 23 May 2019 12:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558639713; cv=none; d=google.com; s=arc-20160816; b=URIIt6Cf96yptqzb6XDbe9ywGQozsDVOsYuNIl7f392RZZiCS8cr+hO+W6HZPRFgjv Z7gfU3Gl/yCicRwtQoO4RiPkKZpcReHCTyLkNj2FhGEfPNy6kJvq2E1/WLWPyLqrKFef IxIGTDBI8TA+ERw+XYQLSsyQr9l5EnMmUIcZXLUP8PYJZptUoTyCZRgTt1R957BU151b IK/9awsgIOhQyASmzFZjWk4usnjp+9pXZORB9wOQjltLB1w2lRTlaCrNnBg6u6tRX+U5 9LhHyuitoUKPWOMnMQYLK+kdilKWC5CZ+s/8ZQ+g+j7S3CdCfM8SvSfxBfhn1YX5fklk 1Chg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W1mDgfBUXhLh4PL2dyGfGaNdoLApP2LvxFEfejhEUaU=; b=KXXOq7HjPEq3ejRjhED8rj0Rku8lrrwVinDPC2CLXJ3NcBVLsOVB8tr24vf/JIRZnv VVww+S0O3VBA5ApvImDbLQ1YWRpKNUknd/KwF3iEFBs2FvgwaI+EcN4sr28Gn1zP+mtq ZqizHYpA4jB41F65eoT6+B8YdB6/ZHk+KF2I0VW8KkHKUEDweTL9CeFtPkgcm3RdL5Gr 1kX6gY+BN3x1AhkP+tdrmfJqg/3QW6sDAG7qmxhklZMY+ApuHSeklMcjWVnVxi0GnVuG V31WoGGM5DSf3JEDObKvOQPUw40aNNckYIkPmtUn5F/NCohweFIrh0eWlm+5Dcxm5ty3 xuYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JSEJ65Lx; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p22si589065plo.341.2019.05.23.12.28.32; Thu, 23 May 2019 12:28:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JSEJ65Lx; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391497AbfEWT2b (ORCPT + 14 others); Thu, 23 May 2019 15:28:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:41156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403755AbfEWT2b (ORCPT ); Thu, 23 May 2019 15:28:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD10121841; Thu, 23 May 2019 19:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558639710; bh=UMvC08lni5aLyINag6W8qHVq+hf79X6rzLlABvFa1xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSEJ65Lx6sjLmlEhZTKmYxzciKcC/2es1fQK5YrMX85KGn2IMxJjYDIGzK8j9gm6D kYukHYlJF/O2VldNmJHWaIbCGw+mY9deWEARZB3s6W/9cHMoS9UnLv5Tz8p6OFY1w0 fMRxiZ9LShg1/LoWSx6WGd8RTitubGxTNsFG2ARY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Sean Young , Mauro Carvalho Chehab Subject: [PATCH 5.1 050/122] media: seco-cec: fix building with RC_CORE=m Date: Thu, 23 May 2019 21:06:12 +0200 Message-Id: <20190523181711.322318490@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181705.091418060@linuxfoundation.org> References: <20190523181705.091418060@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit 63604a143fe168094fbbccba56f6e3241683e399 upstream. I previously added an RC_CORE dependency here, but missed the corner case of CONFIG_VIDEO_SECO_CEC=y with CONFIG_RC_CORE=m, which still causes a link error: drivers/media/platform/seco-cec/seco-cec.o: In function `secocec_probe': seco-cec.c:(.text+0x1b8): undefined reference to `devm_rc_allocate_device' seco-cec.c:(.text+0x2e8): undefined reference to `devm_rc_register_device' drivers/media/platform/seco-cec/seco-cec.o: In function `secocec_irq_handler': seco-cec.c:(.text+0xa2c): undefined reference to `rc_keydown' Refine the dependency to disallow building the RC subdriver in this case. This is the same logic we apply in other drivers like it. Fixes: f27dd0ad6885 ("media: seco-cec: fix RC_CORE dependency") Cc: # 5.1 Signed-off-by: Arnd Bergmann Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -649,7 +649,7 @@ config VIDEO_SECO_CEC config VIDEO_SECO_RC bool "SECO Boards IR RC5 support" depends on VIDEO_SECO_CEC - depends on RC_CORE + depends on RC_CORE=y || RC_CORE = VIDEO_SECO_CEC help If you say yes here you will get support for the SECO Boards Consumer-IR in seco-cec driver. From patchwork Thu May 23 19:06:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 165059 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2623398ili; Thu, 23 May 2019 12:30:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxx9myG3rfjeuduQA/T1hMjbv36Yu+CxPSKUmtwS9UTnQcbKc4x1tQWCcQcqp+xb6Du+2ua X-Received: by 2002:aa7:9615:: with SMTP id q21mr13279759pfg.253.1558639815249; Thu, 23 May 2019 12:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558639815; cv=none; d=google.com; s=arc-20160816; b=LjpVCY+wtPFYrlfLKO5wfrCuT//LZ3ewFmHfPYaF7IhrJWiXJzHArcEbS9/82IedcO e5sOw0O5uQk8IuHaM8ZOnw0EqPzJ+nmynR9uqO2qmt7vsD8xSIPxoG+z0AQrYKt9Pgw8 rP4ZXtGkTvUHQfcJW/WGovdcu6QVf//O4xDMTA62kBh2AQ3IBwMg8ecPAtmRKlfNyl3U ufAhKy1RZa4YMbiRD+DWaoLvgVH5JrD76sc4y1FxzdgS4/QpWefIMLUDetM0aQ4IF99I 1Z41lCHQqEn6CxmP+LdR0N2UPGQ8xhVJTWpW61fpeanFEJ5bKNVmXWbYPaFVIlcrzWMp D9fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lRqkBUqu5IDPL1mH/DqJlmad9bbm3eTPUBXnW7/rUiU=; b=t46h/7qP9k69vpILkcH6IamWxHs5Wygxlbv6vXMHea4s4YZq5aviLq9xZINwIv26VX aST7ZZX91rIq+AHl9ehl3tpEu9O2MDTQMjByvC7n7uh0YQNyYgRX9fD7UchF+KLeXMGC G3KfV9ExcbT/y4u7sAcsfwlt05awFpmNzcQy0uFVnfG4HXoFUQ2GNl/kXAyoocX8O80u aG5IxnORcFTQ7GrU44LFX9JcA3yIiolb2u7OVseDfGj9rnI6Yj6cuYVAJMHGnWUhAF5d 0eOSnkz1ZlIijvzCpjfN26ZY/aca/E96JLEmqjmkmJBmd8NWQqt4eBox4Z+3omdT9PYG 6WLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FIPJs5pP; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v21si581017pgb.560.2019.05.23.12.30.14; Thu, 23 May 2019 12:30:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FIPJs5pP; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392085AbfEWTaO (ORCPT + 14 others); Thu, 23 May 2019 15:30:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:43632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392075AbfEWTaN (ORCPT ); Thu, 23 May 2019 15:30:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A73572133D; Thu, 23 May 2019 19:30:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558639812; bh=OGUu2Sgn161BC2t3viF5PL0nsPJFqDhoMlU0WpAaogM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FIPJs5pPweJZYGilRi0McxlSJqqfTRGy0ZjKTBixtZ+FWXoDsWyitMQR0UT0FDXG6 hRI4i9rM5iwdn3MgFrRqGEVYdAxWGFCshkjsD/6LjiU1QV270/RrgNRRTs1QXXT878 S4eb+cQXrlV6BlDjanmEMU62p/ToQ3HZpTz1u4CU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Hilliard , Ard Biesheuvel , Borislav Petkov , James Morse , Linus Torvalds , Matt Fleming , Peter Jones , Peter Zijlstra , Thomas Gleixner , linux-efi@vger.kernel.org, Ingo Molnar Subject: [PATCH 5.1 085/122] fbdev/efifb: Ignore framebuffer memmap entries that lack any memory types Date: Thu, 23 May 2019 21:06:47 +0200 Message-Id: <20190523181716.171067117@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181705.091418060@linuxfoundation.org> References: <20190523181705.091418060@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ard Biesheuvel commit f8585539df0a1527c78b5d760665c89fe1c105a9 upstream. The following commit: 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB") updated the EFI framebuffer code to use memory mappings for the linear framebuffer that are permitted by the memory attributes described by the EFI memory map for the particular region, if the framebuffer happens to be covered by the EFI memory map (which is typically only the case for framebuffers in shared memory). This is required since non-x86 systems may require cacheable attributes for memory mappings that are shared with other masters (such as GPUs), and this information cannot be described by the Graphics Output Protocol (GOP) EFI protocol itself, and so we rely on the EFI memory map for this. As reported by James, this breaks some x86 systems: [ 1.173368] efifb: probing for efifb [ 1.173386] efifb: abort, cannot remap video memory 0x1d5000 @ 0xcf800000 [ 1.173395] Trying to free nonexistent resource <00000000cf800000-00000000cf9d4bff> [ 1.173413] efi-framebuffer: probe of efi-framebuffer.0 failed with error -5 The problem turns out to be that the memory map entry that describes the framebuffer has no memory attributes listed at all, and so we end up with a mem_flags value of 0x0. So work around this by ensuring that the memory map entry's attribute field has a sane value before using it to mask the set of usable attributes. Reported-by: James Hilliard Tested-by: James Hilliard Signed-off-by: Ard Biesheuvel Cc: # v4.19+ Cc: Borislav Petkov Cc: James Morse Cc: Linus Torvalds Cc: Matt Fleming Cc: Peter Jones Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Fixes: 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when ...") Link: http://lkml.kernel.org/r/20190516213159.3530-2-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/efifb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -476,8 +476,12 @@ static int efifb_probe(struct platform_d * If the UEFI memory map covers the efifb region, we may only * remap it using the attributes the memory map prescribes. */ - mem_flags |= EFI_MEMORY_WT | EFI_MEMORY_WB; - mem_flags &= md.attribute; + md.attribute &= EFI_MEMORY_UC | EFI_MEMORY_WC | + EFI_MEMORY_WT | EFI_MEMORY_WB; + if (md.attribute) { + mem_flags |= EFI_MEMORY_WT | EFI_MEMORY_WB; + mem_flags &= md.attribute; + } } if (mem_flags & EFI_MEMORY_WC) info->screen_base = ioremap_wc(efifb_fix.smem_start, From patchwork Thu May 23 19:07:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 165060 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2624644ili; Thu, 23 May 2019 12:31:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAMJMel5XqchxJkSYaQhsrGlxASrCj3GuIHIoDWakja0HnB3XlNIaApHH56+vucZBDp0IZ X-Received: by 2002:a65:5304:: with SMTP id m4mr4531616pgq.126.1558639875180; Thu, 23 May 2019 12:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558639875; cv=none; d=google.com; s=arc-20160816; b=l8qBTmrciV5Wmft2lc9dgBdMOXq4d1RIayEWcnkF6BhrFX1vHHTfiLr2BRkTbdviKZ 4Vpdrdo+TKhWLwQfBFaKNI8oLyavfLLYONxc6436Z78BKGEr+kRLXMHMI1Pp/E6LlU8O QxZPKEZc9NWSLduZIg+X63ap2EJapUbudVJNn3nUX90MJKIZ9k9lPmwD4+AhR0UYbQfM g6uHiaQ6uY+wIJO/dZze6SyCOJLBKeCbS5EM5fz/7Q/PWn08kXjNLDA9Br2uDOJiLlBW Hag27TmG5Asd/6IFKByngoEIEkXp8ce+hh3yuajVARHb9vE7tQi2hEQiH9fQdXpPnOjJ tUVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ek35xSedyNXrlfArSFjiJ0Bc/eR0aTJDaGrzC2RJusk=; b=LuDxNM+GzKOF0kDyaKiKm+IV5FeS4aa+G7EdwMLygk96g1SqFjBrO03wjl0uvCI1dw yT3hI5v9CjspXPGzYxJYTITWqYDbG06y3pl3uuvZUVdLNaxCA5pnIPPe30O/MGZ8Pftl wlCCHami0wcoWxqUT5qh7jeI1GygA4iYKE0DT+cogHidcm1eYIcB3vqr+Fg22fpPWPx+ WTMvGag5pqhk9GfpTTJUDX7DO8VnsL1XkQGwhNDoqrUDQbwpcUgQYuX0y0PLeyODT/gy fxIlxH/z7MfNBnj28D0ER5PNoYhPiate4HmgZr7WWoEcpYmaNqnAlsdsAMvgByIp7wos txxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ls0VEv5e; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si681618pgv.67.2019.05.23.12.31.14; Thu, 23 May 2019 12:31:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ls0VEv5e; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391788AbfEWTbN (ORCPT + 14 others); Thu, 23 May 2019 15:31:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:44942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392233AbfEWTbM (ORCPT ); Thu, 23 May 2019 15:31:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57697206BA; Thu, 23 May 2019 19:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558639871; bh=Pycf4tZHJJVc1EdtrAOP6wlos8p2T3C9kGsXHQzPX0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ls0VEv5e9zRc6dYSqwuBN1iKy88mXlN8MbuJtmP7XmsN59tBP0QeNVSFxEz3jB8UB 9dWwBtswGAJH5CnFoo6ZEx2HFdG5frwCM9jAZMjyfY0jgL+CZpyKYGt6vLXItu8VmW suPP3txPFQuPd23pn/3u/KpKNK0/V5/TH9iLUN0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiang Chen , John Garry , Robin Murphy Subject: [PATCH 5.1 115/122] driver core: Postpone DMA tear-down until after devres release for probe failure Date: Thu, 23 May 2019 21:07:17 +0200 Message-Id: <20190523181720.748780763@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181705.091418060@linuxfoundation.org> References: <20190523181705.091418060@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: John Garry commit 0b777eee88d712256ba8232a9429edb17c4f9ceb upstream. In commit 376991db4b64 ("driver core: Postpone DMA tear-down until after devres release"), we changed the ordering of tearing down the device DMA ops and releasing all the device's resources; this was because the DMA ops should be maintained until we release the device's managed DMA memories. However, we have seen another crash on an arm64 system when a device driver probe fails: hisi_sas_v3_hw 0000:74:02.0: Adding to iommu group 2 scsi host1: hisi_sas_v3_hw BUG: Bad page state in process swapper/0 pfn:313f5 page:ffff7e0000c4fd40 count:1 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0xfffe00000001000(reserved) raw: 0fffe00000001000 ffff7e0000c4fd48 ffff7e0000c4fd48 0000000000000000 raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set bad because of flags: 0x1000(reserved) Modules linked in: CPU: 49 PID: 1 Comm: swapper/0 Not tainted 5.1.0-rc1-43081-g22d97fd-dirty #1433 Hardware name: Huawei D06/D06, BIOS Hisilicon D06 UEFI RC0 - V1.12.01 01/29/2019 Call trace: dump_backtrace+0x0/0x118 show_stack+0x14/0x1c dump_stack+0xa4/0xc8 bad_page+0xe4/0x13c free_pages_check_bad+0x4c/0xc0 __free_pages_ok+0x30c/0x340 __free_pages+0x30/0x44 __dma_direct_free_pages+0x30/0x38 dma_direct_free+0x24/0x38 dma_free_attrs+0x9c/0xd8 dmam_release+0x20/0x28 release_nodes+0x17c/0x220 devres_release_all+0x34/0x54 really_probe+0xc4/0x2c8 driver_probe_device+0x58/0xfc device_driver_attach+0x68/0x70 __driver_attach+0x94/0xdc bus_for_each_dev+0x5c/0xb4 driver_attach+0x20/0x28 bus_add_driver+0x14c/0x200 driver_register+0x6c/0x124 __pci_register_driver+0x48/0x50 sas_v3_pci_driver_init+0x20/0x28 do_one_initcall+0x40/0x25c kernel_init_freeable+0x2b8/0x3c0 kernel_init+0x10/0x100 ret_from_fork+0x10/0x18 Disabling lock debugging due to kernel taint BUG: Bad page state in process swapper/0 pfn:313f6 page:ffff7e0000c4fd80 count:1 mapcount:0 mapping:0000000000000000 index:0x0 [ 89.322983] flags: 0xfffe00000001000(reserved) raw: 0fffe00000001000 ffff7e0000c4fd88 ffff7e0000c4fd88 0000000000000000 raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 The crash occurs for the same reason. In this case, on the really_probe() failure path, we are still clearing the DMA ops prior to releasing the device's managed memories. This patch fixes this issue by reordering the DMA ops teardown and the call to devres_release_all() on the failure path. Reported-by: Xiang Chen Tested-by: Xiang Chen Signed-off-by: John Garry Reviewed-by: Robin Murphy Signed-off-by: Greg Kroah-Hartman --- drivers/base/dd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -490,7 +490,7 @@ re_probe: if (dev->bus->dma_configure) { ret = dev->bus->dma_configure(dev); if (ret) - goto dma_failed; + goto probe_failed; } if (driver_sysfs_add(dev)) { @@ -546,14 +546,13 @@ re_probe: goto done; probe_failed: - arch_teardown_dma_ops(dev); -dma_failed: if (dev->bus) blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_DRIVER_NOT_BOUND, dev); pinctrl_bind_failed: device_links_no_driver(dev); devres_release_all(dev); + arch_teardown_dma_ops(dev); driver_sysfs_remove(dev); dev->driver = NULL; dev_set_drvdata(dev, NULL);