From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91703C43381 for ; Tue, 19 Mar 2019 14:44:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5834D2133D for ; Tue, 19 Mar 2019 14:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553006688; bh=8f9+rRztcw1UDdDYGZMTjAc1oPSfIOTS1AxRZ++c3CU=; h=Subject:To:From:Date:List-ID:From; b=LfieSL+rxwu1vrWPyfUjRizRDYBGNypher3lOpJI8EwRyf27Vz32EzMPzK6/PKcG/ UPpq3BjKxSHbS7ldBz8dmxJ6Z3IUYgkY2jjNX1f8zGdUo21hjGLmwoZSKqLza1R6Tv vtrqPIMkzcdkr7RS3OSh+4W6GvNSv4js0JACytDc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbfCSOos (ORCPT ); Tue, 19 Mar 2019 10:44:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:56240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726661AbfCSOor (ORCPT ); Tue, 19 Mar 2019 10:44:47 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.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 A60F22133D; Tue, 19 Mar 2019 14:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553006687; bh=8f9+rRztcw1UDdDYGZMTjAc1oPSfIOTS1AxRZ++c3CU=; h=Subject:To:From:Date:From; b=iBXfSakyg55TSSTer5M2qbamYFCcJls9S0T3nFbhmNv3TDlmsexf0u0UkaG6qvJCV gDH4v1Lf7/rPl2m34td4NejmesOH4yi64PjAe1j3s/bfTYHkcqR/k6Bm9BwFdFMOEf 9nxfKUuu1axkLiQ/5tVNlbk3HDkh6X7PPp9K4ycw= Subject: patch "serial: max310x: Fix to avoid potential NULL pointer dereference" added to tty-linus To: pakki001@umn.edu, gregkh@linuxfoundation.org, stable@vger.kernel.org From: Date: Tue, 19 Mar 2019 15:44:26 +0100 Message-ID: <1553006666214199@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled serial: max310x: Fix to avoid potential NULL pointer dereference to my tty git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git in the tty-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From 3a10e3dd52e80b9a97a3346020024d17b2c272d6 Mon Sep 17 00:00:00 2001 From: Aditya Pakki Date: Mon, 18 Mar 2019 18:44:14 -0500 Subject: serial: max310x: Fix to avoid potential NULL pointer dereference 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(+) diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index f5bdde405627..450ba6d7996c 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -1415,6 +1415,8 @@ static int max310x_spi_probe(struct spi_device *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 { -- 2.21.0