Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3577301yba; Mon, 29 Apr 2019 05:06:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZNvTT5UcNiX5UIEd/twpe2MzOE4Mo9DCvGxF5CeVMs6ndQLoLLVS2DH0pGmQO6Rx268Ae X-Received: by 2002:aa7:8dc2:: with SMTP id j2mr23788886pfr.82.1556539577473; Mon, 29 Apr 2019 05:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556539577; cv=none; d=google.com; s=arc-20160816; b=x8gby+1aN4LUOIuVscxkYKZkVqYH7678qujKqmKEaGttmjfN2W/JAwVEQ7V0oPHiNk zxi0X29bA/GdDIAE1QbGLWllWS2fpHkHvchKxlhhSYGDupUIjV7Wo/z/5wj0rjSsJsGM 42fazmB8AoWm4IXoOvDHfqg17Fzhm5e8qn3vxFMInvpfmoVP1Bth0dDxCIx1sNd3Ahuo zNgcncG4j/ipU9cqpu0ZdXxJFW1/jmkDNqb3gRtrv6RFt880OWgouT7/iJ2+H63rzUMv MIRMVrQ35ZhUk+RLFmCkGwbBka0KavAhB2yyXK0ueIqtTCt0t45z0xmxM8VTr+aPbqVp 160w== 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=XcEyTSqG3KsIz0+zncxU9jG5hEJTNv5oOhEeWMAzg7Q=; b=oJukeNtmsBShh23V5ZLA4Ktx20uKsfWD/jJyon5vuD3wKLsk0Cg+28sqWAT/+/Y+v1 pIPmn3quZqQRgFVaU2PatMS+9gbLaF/zWntMckGKXrrVl7Z9oRbIBhgwhz4iEDpwz5U6 1T2RzmfChJeZRLio3YJkiRP7FWeCvwdqonWaPy+xmRaqVwsfpe5jsxTQ94oG5R+FmYyo AvHDJdDQmn6WA7ampkyLUjrDoq+LF6QQwJ5b+g4RoBLK9t5gvA3h1mFNP+iPEnY4Hq/6 BzJZArowLVuJkKEaXhGN6ucSsXih2Hj9T8uAsw7mRM2MGmK1O5509WzkC5OjtWwKhbtX NBMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T4ZKXyTN; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r31si15215002pgk.406.2019.04.29.05.06.01; Mon, 29 Apr 2019 05:06:17 -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=@kernel.org header.s=default header.b=T4ZKXyTN; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728086AbfD2MCe (ORCPT + 99 others); Mon, 29 Apr 2019 08:02:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:56328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727913AbfD2MCe (ORCPT ); Mon, 29 Apr 2019 08:02:34 -0400 Received: from localhost (unknown [171.76.113.243]) (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 AD5A620656; Mon, 29 Apr 2019 12:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556539353; bh=0fAd9AoGr69X9GfL20SKcwdKwfBh6tMYGRr0gGW/6yY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T4ZKXyTNJ7Auyyuee/PNCCGDqOEsBdpwQ2YagiFtiJNUlofMrkNIFDVPBh6vGubfl 5R8fMqJKKLfihjnSFJDq0dmzDpxG/j/tmEn6bCVwxgie3jolXFSCXR8t4gttm3009g 7bAoG2A6YhWqRN84gBHqtKVGuTHBybNxlOGWf4iw= Date: Mon, 29 Apr 2019 17:32:21 +0530 From: Vinod Koul To: Baolin Wang Cc: Dan Williams , eric.long@unisoc.com, Orson Zhai , Chunyan Zhang , Mark Brown , dmaengine@vger.kernel.org, LKML Subject: Re: [PATCH 1/7] dmaengine: sprd: Fix the possible crash when getting engine status Message-ID: <20190429120221.GM3845@vkoul-mobl.Dlink> References: <2eecd528e85377f03e6fbc5e7d6544b9c9f59cb1.1555330115.git.baolin.wang@linaro.org> <20190429113555.GI3845@vkoul-mobl.Dlink> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29-04-19, 19:49, Baolin Wang wrote: > Hi Vinod, > > On Mon, 29 Apr 2019 at 19:36, Vinod Koul wrote: > > > > On 15-04-19, 20:14, Baolin Wang wrote: > > > We will get a NULL virtual descriptor by vchan_find_desc() when the descriptor > > > has been submitted, that will crash the kernel when getting the engine status. > > > > No that is wrong, status is for descriptor and not engine! > > Sure, will fix the commit message. > > > > > > In this case, since the descriptor has been submitted, which means the pointer > > > 'schan->cur_desc' will point to the current descriptor, then we can use > > > 'schan->cur_desc' to get the engine status to avoid this issue. > > > > Nope, since the descriptor is completed, you return with residue as 0 > > and DMA_COMPLETE status! > > No, the descriptor is not completed now. If it is completed, we will > return 0 with DMA_COMPLETE status. But now the descriptor is on > progress, we should get the descriptor to return current residue. > Sorry for confusing description. OKay will wait for updated description to understand the fix > > > > > > > > > Signed-off-by: Baolin Wang > > > --- > > > drivers/dma/sprd-dma.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c > > > index 48431e2..e29342a 100644 > > > --- a/drivers/dma/sprd-dma.c > > > +++ b/drivers/dma/sprd-dma.c > > > @@ -625,7 +625,7 @@ static enum dma_status sprd_dma_tx_status(struct dma_chan *chan, > > > else > > > pos = 0; > > > } else if (schan->cur_desc && schan->cur_desc->vd.tx.cookie == cookie) { > > > - struct sprd_dma_desc *sdesc = to_sprd_dma_desc(vd); > > > + struct sprd_dma_desc *sdesc = schan->cur_desc; > > > > > > if (sdesc->dir == DMA_DEV_TO_MEM) > > > pos = sprd_dma_get_dst_addr(schan); > > > -- > > > 1.7.9.5 > > > > -- > > ~Vinod > > > > -- > Baolin Wang > Best Regards -- ~Vinod