firmware: arm_scmi: Fix null de-reference on error path
authorCristian Marussi <cristian.marussi@arm.com>
Fri, 12 Nov 2021 18:07:05 +0000 (18:07 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Dec 2021 08:04:45 +0000 (09:04 +0100)
commit03339d10253edea4435bccf7223153f9d9d23a13
tree4974f126e70ebde2a9a4c66547b53f2475c43af0
parent75fa2dadb7c26010eef19185eaff40c960a185fd
firmware: arm_scmi: Fix null de-reference on error path

[ Upstream commit 95161165727650a707bc34ecfac286a418b6bb00 ]

During channel setup a failure in the call of scmi_vio_feed_vq_rx() leads
to an attempt to access a dev pointer by dereferencing vioch->cinfo at
a time when vioch->cinfo has still to be initialized.

Fix it by providing the device reference directly to scmi_vio_feed_vq_rx.

Link: https://lore.kernel.org/r/20211112180705.41601-1-cristian.marussi@arm.com
Fixes: 46abe13b5e3db ("firmware: arm_scmi: Add virtio transport")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/arm_scmi/virtio.c