Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp529527yba; Mon, 1 Apr 2019 11:08:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwHOsUgE8rn5UPxNfdliOjB8TFbLPASZgqydyZxk1E3bCbs+Us3Gib77rVCzaPamGFsrpC X-Received: by 2002:a62:e50a:: with SMTP id n10mr41056970pff.55.1554142133788; Mon, 01 Apr 2019 11:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554142133; cv=none; d=google.com; s=arc-20160816; b=GgdXyrT/jCJWj6c5EDGVib9M/1Fo4wUYQaGkS4vjRvZ0njcTNJ6X4SqVX5YSVBJ0bD 4DcyEQN8oUgXelSVmxsyFDkzRvQ0nMC1MdM2NDeL/Oapvrlh1eCA9EfRu/ubmYjlobEl t8mN7Z/LTLaCZFHg4XW7aIEEN9IiDQa04Udhb9dXMiaeJ6zP7nMW7y6T5YQalQ4A/y1v 4x1gVzLxaUXZKC0gVqVwYeLLPJ0mNgI8DaPOUk8uPp2eOT9aFvu5R0srHmNio2MdevE0 eFMv8Bwl7gWiX3bxG/fqAw8kMyWXE/hDHB82B43a23whsu3fPv0+BcUnSHBcp0qmut1u n8VA== 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=7DJt2XLyZPpvOPQZLbqE9hITFLiZZH5ZZc+0AXDknY0=; b=BzsezHR1/GqyL7DjNkQ4X3Ffp5o0U6qSlWFoSurc7spxRnMjB//5QQkwoQAQ56hftq bfAl9ykdjf+tDXLweNZW7Z/wpTtFSiFBJhlbRm/TsrohK9m+aY/ds8oS88447Z/xER98 VM6z1Woh3IOEbaqxdPzd5UcILkrFVCY9Vns1jUkii6MV0jn9hprsW0PSlhzJglftK6Kv vOx1VcdMyNELyjOJjCLYxOxqsmldQdYCXf+Ka/d5cNnzrqdHmrKiJfGoGEMKc9nA8Mnr fgeeTb694b2qkxefTNzXbPAxaaXp2F7O1FsgjnjyN3G0/L8JrV2hm+PKPFCAJnRzGl5I Fesg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=N4m2ftx4; 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 i65si9996426pfb.118.2019.04.01.11.08.38; Mon, 01 Apr 2019 11:08:53 -0700 (PDT) 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=@kernel.org header.s=default header.b=N4m2ftx4; 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 S1729002AbfDARK5 (ORCPT + 99 others); Mon, 1 Apr 2019 13:10:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:59008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729485AbfDARKx (ORCPT ); Mon, 1 Apr 2019 13:10:53 -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 8047821934; Mon, 1 Apr 2019 17:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554138653; bh=NbgTteSypkoUAKJqN/F8UT9jPs0WjHSLWp4PJliR8l4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N4m2ftx4KRPSUoyo/ZLV2ZERie12M1AVIXcdGgr/8v21jl2Iod88fEbMp0f3udvT6 IfGrhl6zI8sl89SyMDpDCqeeOV1nRBAfHGxfgq1MstOYt8XvbE6xzISA5bqEUvv8yG qc8fHMbldON5cQr/cTkqaxctiLaAXbYi3Frcol7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aditya Pakki Subject: [PATCH 5.0 090/146] serial: max310x: Fix to avoid potential NULL pointer dereference Date: Mon, 1 Apr 2019 19:01:42 +0200 Message-Id: <20190401170056.420849609@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401170048.449559024@linuxfoundation.org> References: <20190401170048.449559024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aditya Pakki commit 3a10e3dd52e80b9a97a3346020024d17b2c272d6 upstream. of_match_device can return a NULL pointer when matching device is not found. This patch avoids a scenario causing NULL pointer derefernce. Signed-off-by: Aditya Pakki Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/max310x.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -1416,6 +1416,8 @@ static int max310x_spi_probe(struct spi_ if (spi->dev.of_node) { const struct of_device_id *of_id = of_match_device(max310x_dt_ids, &spi->dev); + if (!of_id) + return -ENODEV; devtype = (struct max310x_devtype *)of_id->data; } else {