From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B95933557EF; Thu, 15 Jan 2026 16:15:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768493704; cv=none; b=fzcBf5VIdtal2z0nbNreyTuVqXWiV9VZ/uNQQDfJKgp65RDEsP3rX8OxWrCYOSJfjRAjAAmvAy4SGrvZQpQG6rLAnvgBM7O8gelaUyP0NH2K+L7haBimqiFG2rwk90PwRo0Zm4zrkEd1IcwDHCY9nzMjLTOyvr/hABFkEemITzo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768493704; c=relaxed/simple; bh=0e+xANG7tvWWdI4qqitOge5wot2owRxJ+LL9YSdqIwM=; h=Content-Type:MIME-Version:In-Reply-To:References:Subject:From:Cc: To:Date:Message-ID; b=HzqmwIfJbD9BUyTyO8yAiO72gp51opoLfd75gWClX/7fu2G7FIVK1rS8LT4tx2rgXPshS+3NTynSXg3FAsl/lYzAiFdJsaAh7IoBojX8TgT9GZ67xB3O8Jdl4jl+PlpPKk9iP98jPLwqx5ZrzEkZnwUU017cuu1EM3dWjQAKHOE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=rnhGALvN; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rnhGALvN" Received: from pendragon.ideasonboard.com (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7C1FB229; Thu, 15 Jan 2026 17:14:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1768493673; bh=0e+xANG7tvWWdI4qqitOge5wot2owRxJ+LL9YSdqIwM=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=rnhGALvNHujbWcu2fqzKjG7AQVOih0W4Oe81tpB88+HXYLJectau0TxYwKsapzovG MtNqRJ5iTYlGtihFKhpLyKcCZlNhl1i89EZ2mn5dyr5kNth63XJ6aMbkUztS5bZWgu 7KiDL3S+wJQzxlUgHscz7s0OrCIhXu83W3QibrPk= Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20260115-rcar-vsp-crash-fix-v1-1-247bd51767fd@ideasonboard.com> References: <20260115-rcar-vsp-crash-fix-v1-1-247bd51767fd@ideasonboard.com> Subject: Re: [PATCH] media: renesas: vsp1: Fix NULL pointer deref on module unload From: Kieran Bingham Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Laurent Pinchart , Tomi Valkeinen , Tomi Valkeinen To: Hans Verkuil , Jacopo Mondi , Laurent Pinchart , Mauro Carvalho Chehab , Tomi Valkeinen Date: Thu, 15 Jan 2026 16:14:58 +0000 Message-ID: <176849369817.1090220.1584761595893232111@ping.linuxembedded.co.uk> User-Agent: alot/0.9.1 Quoting Tomi Valkeinen (2026-01-15 09:22:35) > From: Tomi Valkeinen >=20 > When unloading the module on gen 4, we hit a NULL pointer dereference. > This is caused by the cleanup code calling vsp1_drm_cleanup() where it > should be calling vsp1_vspx_cleanup(). >=20 > Fix this by checking the IP version and calling the drm or vspx function > accordingly, the same way as the init code does. Looks reasonable to me: Reviewed-by: Kieran Bingham >=20 > Fixes: d06c1a9f348d ("media: vsp1: Add VSPX support") > Signed-off-by: Tomi Valkeinen > --- > Signed-off-by: Tomi Valkeinen > --- > drivers/media/platform/renesas/vsp1/vsp1_drv.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drv.c b/drivers/med= ia/platform/renesas/vsp1/vsp1_drv.c > index 6c64657fc4f3..30df9b36642d 100644 > --- a/drivers/media/platform/renesas/vsp1/vsp1_drv.c > +++ b/drivers/media/platform/renesas/vsp1/vsp1_drv.c > @@ -240,8 +240,12 @@ static void vsp1_destroy_entities(struct vsp1_device= *vsp1) > media_device_unregister(&vsp1->media_dev); > media_device_cleanup(&vsp1->media_dev); > =20 > - if (!vsp1->info->uapi) > - vsp1_drm_cleanup(vsp1); > + if (!vsp1->info->uapi) { > + if (vsp1->info->version =3D=3D VI6_IP_VERSION_MODEL_VSPX_= GEN4) > + vsp1_vspx_cleanup(vsp1); > + else > + vsp1_drm_cleanup(vsp1); > + } > } > =20 > static int vsp1_create_entities(struct vsp1_device *vsp1) >=20 > --- > base-commit: 7d0a66e4bb9081d75c82ec4957c50034cb0ea449 > change-id: 20260115-rcar-vsp-crash-fix-8d4871f0f39e >=20 > Best regards, > --=20 > Tomi Valkeinen >