Received: by 10.223.164.202 with SMTP id h10csp1641754wrb; Wed, 8 Nov 2017 07:24:57 -0800 (PST) X-Google-Smtp-Source: ABhQp+QNaVfHg38RjtMeldajz5gg8q/KBVLID+xSLJave2ozJl/xEdGXAITsqZg8agtPAogyAT8/ X-Received: by 10.99.114.30 with SMTP id n30mr78725pgc.129.1510154697506; Wed, 08 Nov 2017 07:24:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510154697; cv=none; d=google.com; s=arc-20160816; b=HsOHlLR7HnV5LuZOqdGNwRbkmu0WwAZX+omdr/44s56csIRjvlPYbRcUVIBQCJ7LHd fDWHgXhrJMIr6ceYmSzuh/vq4BZDEZ2fy4ioLF7/CiCB6rxtYa5X6Ev5E7Z62BkvjOV9 pQ8SrC9fNQCbGxZEWZq1aGW7KuYDqtjyGzFW4MbQ+Op5yIldfgWhygINarq+4+C0px4Z WZcd1IzF7d7l4giWH5DTl15M84BqGaJX3Lke3shGCBMYKs5CDk9TPOpCyrzdcmpMOMVW 5gX7e3FMe4nkM6qqMJ42j3QVJBk4K03OnEGo59TKMzBDOLil62w7av61KfQ+ANf2qNDs PrpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=aQvH/rZ+eMQhn504OxVgzch+2+FioB1Kcz0VmcuJL1Q=; b=Pq+ymJzv/QK06ImaRMGXDAREQuHbWc4Guhcjcy35CztQhhfOleHnBDr0DOrJFD+13b DlyCdfgWX77NVt89W/Op3VEIjs+Tv358T7F+i9XaWncnmAVPdxKZ9+BeceLxW42PiEWP 2+rUDICGCLe+EZcV5ABa+prpuUVOH8euqkDxLj8sJ+w/ZgBQYNDsS1I4YcrMHYK5Lrl5 D3Htu/qUAXlYbTqw55iMsX6VbZS8vi+v14vWb9IqIsYuHrMFz8q2lOab9XyuDIHLt8la Xd/6yyiW7zof4X/nghvTGI/qNv4/3Q5WS/Rrkr35z/GkBZbCH9UooIzEfbgsqCmRU4b3 8Npg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LHpPAQHt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10si3424990plp.112.2017.11.08.07.24.45; Wed, 08 Nov 2017 07:24:57 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LHpPAQHt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752712AbdKHPXq (ORCPT + 83 others); Wed, 8 Nov 2017 10:23:46 -0500 Received: from mail-yw0-f196.google.com ([209.85.161.196]:49915 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751304AbdKHPXn (ORCPT ); Wed, 8 Nov 2017 10:23:43 -0500 Received: by mail-yw0-f196.google.com with SMTP id z195so2578003ywz.6 for ; Wed, 08 Nov 2017 07:23:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=aQvH/rZ+eMQhn504OxVgzch+2+FioB1Kcz0VmcuJL1Q=; b=LHpPAQHt3huJkPDniFEfm1phelH6J3jTYCUCtNGJcJZM5aO9icbS5QMdA9IVEg/rkB 5AC3Dw/jmr3a/zYZLpygmXLSPvca/OkO719Fg2ZKQEw7VmGwjuRRwNUBgImyWmvGOnHA 573elvtJK2m9c7IpVhHAxEfgx5su2gk/VHH/BUH46mm8qUeneKfReyzzoKil6f3+P7H8 jg4QPe+68lZRdL2GYMBR1O+mXHHLn8dUDB8/GRqZoofPy3K5v6FHhE8n+CKDxQkyDwKF vJUjwBNw2dLjENZD5si8PXGx/BKww+Vhndfyu+DfbgK0FDr8oq9xqmv6eVjITMGJfTqP IRrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aQvH/rZ+eMQhn504OxVgzch+2+FioB1Kcz0VmcuJL1Q=; b=bsITVxdMNhuISwaEXvWmt5UbIzy6/GQuUFfuUQ1dVN98QbPvdsPEvRfiR191Uu5EHn 2I9u2juIekfHD7rd3HwafT1Ixl6kzoaBvIQQSxTI87qfNZZNK7MldgSp4vF46piOuCpy DQNkfljwDn1MvOWMAphkbwvW4AsRu94mhqaF+j+sFGL0NaovJ6ZTMSm2VZo8NODk+4FB tJsMWgXUZSa/reqMNduUYvJCs2ynNPrZTdGCS/A/tdXn/4uektDB4pZx504q5SJ59XTM B5ltJe8yuohSr/qE7DJU7UBqbOAteF55hqD0tIMigutJ0omUnMegVFmfFEQ2hUvvoI6L HGzQ== X-Gm-Message-State: AJaThX4RA28a4dkiBwwN9UWi6NfFg3jBM+j3FLKPFlmkSZlVDM0wqR+F Xffkny+zG9j77Op7rufB4EE= X-Received: by 10.37.186.7 with SMTP id t7mr572743ybg.495.1510154623307; Wed, 08 Nov 2017 07:23:43 -0800 (PST) Received: from localhost ([72.188.97.40]) by smtp.gmail.com with ESMTPSA id u2sm2216659ywi.82.2017.11.08.07.23.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Nov 2017 07:23:42 -0800 (PST) From: William Breathitt Gray To: gregkh@linuxfoundation.org Cc: fengguang.wu@intel.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, William Breathitt Gray Subject: [PATCH] isa: Prevent NULL dereference in isa_bus driver callbacks Date: Wed, 8 Nov 2017 10:23:11 -0500 Message-Id: <20171108152311.14469-1-vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.15.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/base/isa.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/base/isa.c b/drivers/base/isa.c index cd6ccdcf9df0..372d10af2600 100644 --- a/drivers/base/isa.c +++ b/drivers/base/isa.c @@ -39,7 +39,7 @@ static int isa_bus_probe(struct device *dev) { 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 *dev) { 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 device *dev) { 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 *dev, pm_message_t state) { 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 *dev) { 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; -- 2.15.0 From 1583232185232215414@xxx Sun Nov 05 13:17:51 +0000 2017 X-GM-THRID: 1583050374100480548 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread