From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753299AbeDLV2G (ORCPT ); Thu, 12 Apr 2018 17:28:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46424 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753206AbeDLV2E (ORCPT ); Thu, 12 Apr 2018 17:28:04 -0400 Date: Thu, 12 Apr 2018 14:28:03 -0700 From: Andrew Morton To: Ioan Nicu Cc: Alexandre Bounine , Barry Wood , Matt Porter , Christophe JAILLET , Al Viro , Logan Gunthorpe , Chris Wilson , Tvrtko Ursulin , Frank Kunz , Alexander Sverdlin , linux-kernel@vger.kernel.org Subject: Re: [PATCH] rapidio: fix rio_dma_transfer error handling Message-Id: <20180412142803.cd235a40155503700dc73b21@linux-foundation.org> In-Reply-To: <20180412150605.GA31409@nokia.com> References: <20180412150605.GA31409@nokia.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 12 Apr 2018 17:06:05 +0200 Ioan Nicu wrote: > Some of the mport_dma_req structure members were initialized late > inside the do_dma_request() function, just before submitting the > request to the dma engine. But we have some error branches before > that. In case of such an error, the code would return on the error > path and trigger the calling of dma_req_free() with a req structure > which is not completely initialized. This causes a NULL pointer > dereference in dma_req_free(). > > This patch fixes these error branches by making sure that all > necessary mport_dma_req structure members are initialized in > rio_dma_transfer() immediately after the request structure gets > allocated. This sounds like something which someone has actually triggered in a real-world situation. So I added a cc:stable. Please let me know if that was inappropriate. And please remember to always include all information regarding end-user impact when fixing bugs.