mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] media: dvb-frontends: a8293: validate platform data
@ 2026-07-20  1:07 Nikhil Gurudasani
  2026-07-20  1:07 ` [PATCH 2/2] media: dvb-frontends: a8293: reject short probe reads Nikhil Gurudasani
  0 siblings, 1 reply; 2+ messages in thread
From: Nikhil Gurudasani @ 2026-07-20  1:07 UTC (permalink / raw)
  To: linux-media
  Cc: linux-kernel, mchehab, hverkuil+cisco, crope, u.kleine-koenig, kees

a8293_probe() dereferences platform data before checking it. An I2C
device instantiated without the expected platform data therefore causes
a NULL pointer dereference during probe.

Reject devices that do not provide both the platform data and DVB
frontend.

Fixes: b561baec11a4 ("[media] a8293: implement I2C client bindings")
Signed-off-by: Nikhil Gurudasani <nikhilgurudasani314@gmail.com>
---
 drivers/media/dvb-frontends/a8293.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/a8293.c b/drivers/media/dvb-frontends/a8293.c
index 52e3dc928327..14e7f6bda10c 100644
--- a/drivers/media/dvb-frontends/a8293.c
+++ b/drivers/media/dvb-frontends/a8293.c
@@ -213,11 +213,16 @@ static int a8293_set_voltage(struct dvb_frontend *fe,
 static int a8293_probe(struct i2c_client *client)
 {
 	struct a8293_dev *dev;
-	struct a8293_platform_data *pdata = client->dev.platform_data;
-	struct dvb_frontend *fe = pdata->dvb_frontend;
+	struct a8293_platform_data *pdata = dev_get_platdata(&client->dev);
+	struct dvb_frontend *fe;
 	int ret;
 	u8 buf[2];
 
+	if (!pdata || !pdata->dvb_frontend)
+		return -EINVAL;
+
+	fe = pdata->dvb_frontend;
+
 	dev = kzalloc_obj(*dev);
 	if (!dev) {
 		ret = -ENOMEM;

base-commit: a52e6f7923c17a672135b485ffd96fbd72f46267
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-20  1:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-20  1:07 [PATCH 1/2] media: dvb-frontends: a8293: validate platform data Nikhil Gurudasani
2026-07-20  1:07 ` [PATCH 2/2] media: dvb-frontends: a8293: reject short probe reads Nikhil Gurudasani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®