Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3339614imu; Mon, 7 Jan 2019 01:18:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/XTlaOtCmY9kN0sW7ZYBH9hsuDW6h+e1tEU7golq5YLu+ZAXnp70ffPTZodIJ4Jy36za6I1 X-Received: by 2002:a62:442:: with SMTP id 63mr61178832pfe.156.1546852730061; Mon, 07 Jan 2019 01:18:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546852730; cv=none; d=google.com; s=arc-20160816; b=hGu4p1rfQDj5vEW68gnlKSLgP+dSXtAdIpE9oi7/Jn1WNAncbzQFzQwloHRbZoo70k R0KQ2MuWXvJWR9C6ybGrrjq2CGBLmI2XiyF7ztF0C8gSGgbEeOIDnYj3qqzWeAwCDYzi f1BXLtu9lsAkjIphSXcKe7cL7UQzfes577utd9RIMsQiyDSlIOTeWT3XNvSnOyZCwTiv Jbi5cpG6i0TCSNOLtRrToalxhA/oSqeBYiH5svXgKTnXF8PaQiofLJ5IqJtH6R3ItmmA RzrhFicMh4FqT3hm0Hs/1cyDmL78D6xQ1IWlL6UKQQyyJZG/ptu9wkPASX7aqtcuhTnl eHjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=A1EM1nfA+UvfdWbNnNXPdxqUqARp1K6zpHracWbL1SE=; b=ufzVIBq7wycb1T8MXAaz8gO0AaKspmMehGD47wksWn4mj7PSdsUTt8iGMqPF7P2yn4 NM12w2U2EQ8rkM845QPjEHW34/YRbMw7JMdJmk8c3uSdJHSkHA4lzNP7gpB6AzkB3A/F 0M2sD+2EnyHgtOJOAwvNI1JzghZdLfM2/99B6wyZ+jgmiHsdnob63QZ1gVmo4iSRVj9P IZqiEv7Az6reoDiSJHL+pnot8dL4p4F55JG/hC5fcrPez2y0y2trHbGVclYE2PK0ECEG k7PhxpQW75uAW4Br3i9U3g+0h4tALLnw9E9PBfxarnXpO0fHwQmQdQ+gz6NFjGSpi9GH 6ltQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2W7ebwCN; 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 w5si5554635pll.64.2019.01.07.01.18.34; Mon, 07 Jan 2019 01:18:50 -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=@kernel.org header.s=default header.b=2W7ebwCN; 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 S1726595AbfAGIw1 (ORCPT + 99 others); Mon, 7 Jan 2019 03:52:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:49424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726404AbfAGIw1 (ORCPT ); Mon, 7 Jan 2019 03:52:27 -0500 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 E416620859; Mon, 7 Jan 2019 08:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546851146; bh=ndjcPIKIoRsAHa7bF8X/UlNyLNC6aQ5WOM/+q6rW6Ks=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2W7ebwCNLeUxNKKccUkJy6GgopCyBdLAorb4X4cC5YIM8sOmIOxY7agOkl2NMcFkk v1Dt1m6xOxXQQJ+jqYuhmPVdivUCdNDQ1YEj5B9zBnWSOtu6QOP2Wwodmug1f+Y21C fh3dIyGWOKcB+PjiYqJhwTl0qeDTYWAMEUxisb2k= Date: Mon, 7 Jan 2019 09:52:24 +0100 From: Greg KH To: Jia-Ju Bai Cc: jslaby@suse.com, linux-serial@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [BUG] tty: serial: mxs-auart: possible concurrency use-after-free bugs in mxs_auart_dma_exit_channel() Message-ID: <20190107085224.GA26384@kroah.com> References: <8da85649-f539-9c36-a97e-3582844e82fb@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8da85649-f539-9c36-a97e-3582844e82fb@gmail.com> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 07, 2019 at 04:47:43PM +0800, Jia-Ju Bai wrote: > The driver functions mxs_auart_settermios(), dma_rx_callback() and dma_tx_callback() can be concurrently executed. > > In Linux 4.19: > > mxs_auart_settermios > mxs_auart_dma_exit > mxs_auart_dma_exit_channel > line 918: kfree(s->tx_dma_buf); > line 919: kfree(s->rx_dma_buf); > > dma_rx_callback > line 862: tty_insert_flip_string(port, s->rx_dma_buf, count); > mxs_auart_dma_prep_rx > line 890: sg_init_one(sgl, s->rx_dma_buf, UART_XMIT_SIZE); > > dma_tx_callback > mxs_auart_tx_chars > line 590: void *buffer = s->tx_dma_buf; > mxs_auart_dma_tx > line 566: sg_init_one(sgl, s->tx_dma_buf, size); > > Thus, possible concurrency use-after-free bugs may occur. > > These possible bugs are found by a static analysis tool written by myself and my manual code review. Care to send a patch to fix up this issue? thanks, greg k-h