Received: by 10.223.185.116 with SMTP id b49csp6410310wrg; Wed, 28 Feb 2018 08:58:42 -0800 (PST) X-Google-Smtp-Source: AH8x226Jn2DtYFtCPRYlOncNrzTHZi3SsKYVkis8kEZqOE75U+LNkiPKuUuZ9/HZJSWIAlH3ooR5 X-Received: by 10.99.64.197 with SMTP id n188mr14739608pga.21.1519837122392; Wed, 28 Feb 2018 08:58:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519837122; cv=none; d=google.com; s=arc-20160816; b=gcVZ2zRmORE1z5Ei650yk8exXEFfZ9crjqO+aCtdv36sIk5kr/pSikAQn0bYHDtoJQ zmPXnQCfPvohVjDbb9VpxVUdoBq9iv/7uaFc2xOk1haC9NdTwvky44yxrmbMRbtSK0CK fJacv8FtSv4E7pjJstscsJp9kISTkpHXKde08RFUMX7dKQ4H5G5HzvcddSkoHR+aKXFa 6xeLpoC0lQpn4IuGkXcI5Y8jeZmMXl/8M9IyVl8rYib/mOk5DgbPf23tM2nrMd+rIcjI QMnmNGfS/ZbcjEABTpbT8H6xTZCtSgviebX1WhBfrhgKHZ49S0vXuesXlCjb8rmi2/6s jMxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=TkvVKiDdrSdhTcQorRw5nwSma3dKcjPAp28SJiYvvHs=; b=ej8ohRvu3DWAPSx9OYLCPLXezsBcXatQ4nTSigthWrmDbtq98pG9Lil7zaWimiSCyx zie391esjxZhYgCbPTn3c6OVuIf5oN9LEfAG1tMCWLyf4B7QxW7vdsWLJl7M/vulxcnk buM8iqWoH4XmKcwsqbo044kxn9ERblBPV+b1MwOYzlS73fUaRGal7Gcg/vEgl/aZ5Q/z OptMxfAUeJICKM9FZeCTVJecbi4JVEhQ9vgrma1hiAxI5t4QzElWID2R69oCY3/V19X9 y0uSE9fuUpt499KVchA7R3QZvGPNEh2+zgVCJj3Svi2n6kuWolIoguuzWysH0WNcCvAC y+dA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 g27-v6si1583955plj.665.2018.02.28.08.58.27; Wed, 28 Feb 2018 08:58:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933112AbeB1Q53 (ORCPT + 99 others); Wed, 28 Feb 2018 11:57:29 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34428 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933779AbeB1Pw7 (ORCPT ); Wed, 28 Feb 2018 10:52:59 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yu-0006XU-DA; Wed, 28 Feb 2018 15:22:32 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yd-0008OQ-MM; Wed, 28 Feb 2018 15:22:15 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "William Breathitt Gray" , "Linus Torvalds" , "Greg Kroah-Hartman" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 028/254] isa: Prevent NULL dereference in isa_bus driver callbacks In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: William Breathitt Gray commit 5a244727f428a06634f22bb890e78024ab0c89f3 upstream. The isa_driver structure for an isa_bus device is stored in the device platform_data member of the respective device structure. This platform_data member may be reset to NULL if isa_driver match callback for the device fails, indicating a device unsupported by the ISA driver. This patch fixes a possible NULL pointer dereference if one of the isa_driver callbacks to attempted for an unsupported device. This error should not occur in practice since ISA devices are typically manually configured and loaded by the users, but we may as well prevent this error from popping up for the 0day testers. Fixes: a5117ba7da37 ("[PATCH] Driver model: add ISA bus") Signed-off-by: William Breathitt Gray Acked-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/base/isa.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/base/isa.c +++ b/drivers/base/isa.c @@ -39,7 +39,7 @@ static int isa_bus_probe(struct device * { struct isa_driver *isa_driver = dev->platform_data; - if (isa_driver->probe) + if (isa_driver && isa_driver->probe) return isa_driver->probe(dev, to_isa_dev(dev)->id); return 0; @@ -49,7 +49,7 @@ static int isa_bus_remove(struct device { struct isa_driver *isa_driver = dev->platform_data; - if (isa_driver->remove) + if (isa_driver && isa_driver->remove) return isa_driver->remove(dev, to_isa_dev(dev)->id); return 0; @@ -59,7 +59,7 @@ static void isa_bus_shutdown(struct devi { struct isa_driver *isa_driver = dev->platform_data; - if (isa_driver->shutdown) + if (isa_driver && isa_driver->shutdown) isa_driver->shutdown(dev, to_isa_dev(dev)->id); } @@ -67,7 +67,7 @@ static int isa_bus_suspend(struct device { struct isa_driver *isa_driver = dev->platform_data; - if (isa_driver->suspend) + if (isa_driver && isa_driver->suspend) return isa_driver->suspend(dev, to_isa_dev(dev)->id, state); return 0; @@ -77,7 +77,7 @@ static int isa_bus_resume(struct device { struct isa_driver *isa_driver = dev->platform_data; - if (isa_driver->resume) + if (isa_driver && isa_driver->resume) return isa_driver->resume(dev, to_isa_dev(dev)->id); return 0;