Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753534AbcLJOKp (ORCPT ); Sat, 10 Dec 2016 09:10:45 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53198 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752818AbcLJOKo (ORCPT ); Sat, 10 Dec 2016 09:10:44 -0500 Date: Sat, 10 Dec 2016 15:10:42 +0100 From: Greg Kroah-Hartman To: Alexey Khoroshilov Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: Re: [PATCH] tty: serial: fsl_lpuart: potential NULL dereference Message-ID: <20161210141042.GA19758@kroah.com> References: <1481322636-30847-1-git-send-email-khoroshilov@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1481322636-30847-1-git-send-email-khoroshilov@ispras.ru> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 523 Lines: 14 On Sat, Dec 10, 2016 at 01:30:36AM +0300, Alexey Khoroshilov wrote: > tty_port_tty_get() might return a tty which is NULL > if the port is not associated with a tty > (e.g. due to close or hangup). > But lpuart_start_rx_dma() dereferences tty without any check. Are you sure that tty could ever be NULL here? This function is only called in places that seem to have a valid tty, with the maybe exception of the resume call path. Can you audit this a bit better to be sure one way or the other please? thanks, greg k-h