Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1071841ybs; Mon, 25 May 2020 06:34:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxe4RiQAMYwOf46RRtu7p8pO52KU14TpZ/KfACD6GPE4x8yRnVted6avFGX3kaArfH6iBLw X-Received: by 2002:a17:907:20d9:: with SMTP id qq25mr18211271ejb.202.1590413677515; Mon, 25 May 2020 06:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590413677; cv=none; d=google.com; s=arc-20160816; b=spbimQFqP9PQ6Nu27gbFI6GKNXciBCAOCTBYEJAHGkN+9ksGXUG7S1/dq1Nkh+i490 sjNTRg6kyLhXheD+EuV84BEOWxsCgRaI/DADKi4CAhNvEk2NMzCCpehnJEFohZMxYIFX KOpdJYsVLWSrLbKQ1k89ZVsaVhtsZ4zJG1lommDqEiCRP8UdARXNk46yoKK4H/JgiNE9 WwC0MNUWZlRBlN4HutMirVryhVJ8tkYxbp5Ih8j1RFbzNbWtMUk1hwLlEmPE1JqFoNIV 5pQs7gmqDx+2hNPtNe91CP3DvRG+ihFX1mBazYRkJ5BNb+meeKXQ2eHOE/2d9IWeYeJ4 5NRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=/4aWzROKPo/TWY6sDX+AtxbCaKgbWUcVVDR3kAn56jY=; b=ceTKgVW9Prk2zzVq4gBx3hNIQc9cOSLU0/rRfhpjPaziL2ZtnqX6qoH/ynlraTqQ3L /qnr+pCt0h6XxwSVabvdOk+LK6XOkpFibpZquDUEZPfJnj7PEyVEQo6FhwnzQwkX1INQ z1IUKilLLarXzcX7+pgmMIo6NRql5OLLMsWsvo2eYh5qzUmmeS91UZ0aKZg7m5Z0f1wH 0zw1QA/ifRpr108FK34VCk18fBMoNsOmaheUdd6OuOW5PHvV3JJpLJkv+ZAZ9TokTaYc XXr5wbHg6m4pofJ1HJ9wZ0kv6TBa4MmZrnRxa0x9ztZegbB7XgIScNHRYgXwVsLzxbwR Jc8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si8970159ejk.317.2020.05.25.06.34.13; Mon, 25 May 2020 06:34:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390792AbgEYNcL (ORCPT + 99 others); Mon, 25 May 2020 09:32:11 -0400 Received: from smtp1.de.adit-jv.com ([93.241.18.167]:54183 "EHLO smtp1.de.adit-jv.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390754AbgEYNcK (ORCPT ); Mon, 25 May 2020 09:32:10 -0400 Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id 244513C057C; Mon, 25 May 2020 15:32:07 +0200 (CEST) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1IwUF-psCmTU; Mon, 25 May 2020 15:32:01 +0200 (CEST) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id E8C5E3C0022; Mon, 25 May 2020 15:32:01 +0200 (CEST) Received: from lxhi-065.adit-jv.com (10.72.94.46) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.487.0; Mon, 25 May 2020 15:32:01 +0200 Date: Mon, 25 May 2020 15:31:57 +0200 From: Eugeniu Rosca To: Kieran Bingham CC: Eugeniu Rosca , Laurent Pinchart , Mauro Carvalho Chehab , , , , Eugeniu Rosca , Subject: Re: [PATCH] media: vsp1: dl: Fix NULL pointer dereference on unbind Message-ID: <20200525133157.GA19608@lxhi-065.adit-jv.com> References: <20200523081334.23531-1-erosca@de.adit-jv.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.72.94.46] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kieran, On Mon, May 25, 2020 at 02:19:02PM +0100, Kieran Bingham wrote: > Hi Eugeniu, > > Yeouch. Looks like I really missed a trick there! Not a big deal. The good part is that it can be proactively fixed and shared across the community. > > We should probably update the $SUBJECT to match what is performed in the > patch, which is perhaps more like: > > "media: vsp1: dl: Store VSP reference when creating cmd pools" To be honest, I am not a big fan of WHAT summary lines. Rather, I prefer the WHY summary lines (and I think everyone should). > > On 23/05/2020 09:13, Eugeniu Rosca wrote: > > And then we can explain here: > > In commit f3b98e3c4d2e16 ("media: vsp1: Provide support for extended > command pools"), the vsp pointer used for referencing the VSP1 device > structure from a command pool during vsp1_dl_ext_cmd_pool_destroy() was > not populated. > > Correctly assign the pointer to prevent the following > null-pointer-dereference when removing the device: That sounds good and I can push this improved description as v2. > > Fixes: f3b98e3c4d2e16 ("media: vsp1: Provide support for extended command pools") > > Cc: stable@vger.kernel.org # v4.19+ > > Signed-off-by: Eugeniu Rosca > > Reviewed-by: Kieran Bingham > > > --- > > > > How about adding a new unit test perfoming unbind/rebind to > > http://git.ideasonboard.com/renesas/vsp-tests.git, to avoid > > such issues in future? > > Yes, now I wish I had done so back at 4.19! I hope this wasn't too > painful to diagnose and fix, and thank you for being so thorough in your > report! > > > > Locally, below command has been used to identify the problem: > > > > for f in $(find /sys/bus/platform/devices/ -name "*vsp*" -o -name "*fdp*"); do \ > > b=$(basename $f); \ > > echo $b > $f/driver/unbind; \ > > done > > > > I've created a test to add to vsp-tests, which I'll post next, thank you > for the suggestion. > > Before your patch is applied, I experience the same crash you have seen, > and after your patch - I can successfully unbind/bind all of the VSP1 > instances. > > So I think you can have this too: > > Tested-by: Kieran Bingham Awesome. Thanks! -- Best regards, Eugeniu Rosca