Received: by 10.192.165.156 with SMTP id m28csp2391510imm; Thu, 12 Apr 2018 13:31:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/7wrh5nDJEJqU8YWXzSiJecz09BodvOeBUazteLXSirUssIkAxDdyaRe9FL8iKWqXBxdLl X-Received: by 10.99.96.66 with SMTP id u63mr1833332pgb.22.1523565119385; Thu, 12 Apr 2018 13:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523565119; cv=none; d=google.com; s=arc-20160816; b=gnHTH2URKzv3ZDZrZA8pI6nOur6G9dgDJjm+4Y4LznlSWT+f8+x6xcmeLWwK4nRuLq qcMZE4+YGsBFcuHuBKDVFKbft8kI7Yb6eOC7/0Gw1R18H/WhUIacvz9U7zu4ifpRiD8L 5+OnJkfPzXc/tyAJ5CBOYj2xPqWywen9C44ThIUdcjeXZzBV/xl00kO+XD2UKJtQVYTp a2tGXDU2foo+gpDP6pS6uBfce0OTsH9khUqDTfd1GfUsfuI8F4W4Xw1ZZ2d+x4Hf20Su Zq4OQoRNJS/sMfRL+KgKNLpaBIzUQ3mT/nP18xkB1KrM2e6U/qk4YTK2rfdfR8I2VKE+ 80rg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature :arc-authentication-results; bh=28AT4/ctctz7E3PU49iZArbMW0bVDxU/GX//xtAupP4=; b=ScoLfS8p84lBYaBNM05BCz19dto2Qty7KznAHBgGKdrRCsc6iNp6THc78TdtWRV1kG 7CCm3T7lPT3c/EETpJDnYkIIXg6TaYYIuDULAEvk71iVwqvWsrO22RzQuHafN1tBmq7l Yvl4nL0bziWSHtqcG2k8DvCBSus8iZiIAsebQfrfWH1RFnJ2IzjnObbfbrE+u3gNCrt8 qd/MvoKClZWuRy04wQiF6zxKkchIH7pkooKrNj+KIRsYTnfiKd8S1b8awplM3K7ns3ik Cd5oOc1dSUygoobTF58sgJCfCiHlgChPFf02AlgZn3ikn0v1p3a6sVAh+Ez6VK5d0vZf n63g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=k2OU7bPg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13-v6si3851344plo.150.2018.04.12.13.31.43; Thu, 12 Apr 2018 13:31:59 -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=@gmail.com header.s=20161025 header.b=k2OU7bPg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753089AbeDLSr7 (ORCPT + 99 others); Thu, 12 Apr 2018 14:47:59 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:37061 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753031AbeDLSr5 (ORCPT ); Thu, 12 Apr 2018 14:47:57 -0400 Received: by mail-io0-f195.google.com with SMTP id y128so7456451iod.4 for ; Thu, 12 Apr 2018 11:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=28AT4/ctctz7E3PU49iZArbMW0bVDxU/GX//xtAupP4=; b=k2OU7bPgCqaL1+uhPClHhnrzNF+XKgUNMk+EGM3903d8vI2EeZ1BobNNpoVqr97qGj FDHv4OuT4mamwT+hf+cbY40hu2mHO//lRCCoaccInAwz/YY1SSQeOB/E19/GLydUqrgy UHsGmp3vcYlfvjprWO9aVwiWD+rjdM3iDHhAJTnqZ/ZMOO+dnOyr5gSs2qTw89cgXagf l8UitrZ2Wrg3WuL2yTAWXtWdwxEfKbeHgT6z6u8wB41icgopDA0xf2X+FlKRbi6Ll/Ju J7kB6Di524dZTTTwH6eLnC7Id4PrMfRqRYufune6YQqoR3b3AOEBkUg0hEiiEq/kGnbV LU0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=28AT4/ctctz7E3PU49iZArbMW0bVDxU/GX//xtAupP4=; b=Ocvs7oef/z0mhTasm+Vcpy79vKIkQygsLmk4lSrw1XjvUtZGTXp5CtJPiPlEfLQf2E DT3DSPxol1i/S1PGIINhmTGjN34KPhAf7qX2/roxmWxgxwwvCrn8hwBIu4NPCXPGb9HR EZTlqp4/GPCx9//gPP1+ZYc0EtTDlAZekTo3Yg5mTwDDxhWHaVWUl4hWZ+g/krXf/xQY S8M0jyDnJ6TQalHtIRu8/V13FXdXVQAfN16aktBGTaodM+1fUPbvpJyDJejPufexD1DO eOa91RipGbWvuV/nWFTIMKstgIGQjdN/J0A19u4z4pZkZ1xbSVGe80XX1NGnox09Rezx lJ1A== X-Gm-Message-State: ALQs6tA2Mjh2G5io/IoH2GQSsOEzBRWlNL1KRe0lm5y9T5oxJXf5e1X1 vXTlb9v8PuDpdX3D+Awo9scrbChbsEs= X-Received: by 10.107.175.79 with SMTP id y76mr9931869ioe.215.1523558877159; Thu, 12 Apr 2018 11:47:57 -0700 (PDT) Received: from [10.0.2.15] (CPEac9e17937810-CM64777dd8e660.cpe.net.cable.rogers.com. [99.245.240.231]) by smtp.gmail.com with ESMTPSA id d1sm1737397iog.12.2018.04.12.11.47.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Apr 2018 11:47:56 -0700 (PDT) Subject: Re: [PATCH] rapidio: fix rio_dma_transfer error handling To: Ioan Nicu , Barry Wood , Matt Porter , Andrew Morton , Christophe JAILLET , Al Viro , Logan Gunthorpe , Chris Wilson , Tvrtko Ursulin , Frank Kunz , Alexander Sverdlin , linux-kernel@vger.kernel.org References: <20180412150605.GA31409@nokia.com> From: Alexandre Bounine Message-ID: <933db59f-c28d-fb2c-9423-08828621de7a@gmail.com> Date: Thu, 12 Apr 2018 14:47:49 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180412150605.GA31409@nokia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-04-12 11:06 AM, 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. > > Signed-off-by: Ioan Nicu > --- > drivers/rapidio/devices/rio_mport_cdev.c | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) > Acked-by: Alexandre Bounine