[PATCH] media: siano: free the smsclient after the DVB devices are gone
From: YuanZhe Liu
Date: Wed Nov 25 2026 - 04:09:01 EST
A KASAN slab-use-after-free read was observed in smsclient_sendrequest()
when a demux file descriptor is closed after the Siano USB receiver has
been disconnected:
Read of size 8 at addr ffff888006067a10
smsclient_sendrequest
smsdvb_stop_feed
dmx_section_feed_stop_filtering
dvb_dmxdev_feed_stop
dvb_dmxdev_filter_stop
dvb_dmxdev_filter_free
dvb_demux_release
The object is the smscore_client_t created by smscore_register_client().
smsdvb_unregister_client() frees it through smscore_unregister_client()
before the frontend and the demux are torn down.
dvb_dmxdev_release() waits for userspace to close the demux device nodes,
and the close path calls the stop_feed() callback before it drops the
device user count. A demux file that is still open when the device is
disconnected therefore always reaches smsdvb_stop_feed() after
client->smsclient has been freed.
Move the smscore_unregister_client() call to the end of the teardown,
after dvb_unregister_frontend() stopped the frontend thread and after
dvb_dmxdev_release() drained the open demux files. At that point no
callback can reach the client any more.
Fixes: 2e5c1ec8865a ("V4L/DVB (8258): add support for SMS1010 and SMS1150 based digital television devices")
Cc: stable@xxxxxxxxxxxxxxx
Co-developed-by: Bin Yu <byu@xxxxxxxxxxxxx>
Signed-off-by: Bin Yu <byu@xxxxxxxxxxxxx>
Co-developed-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: YuanZhe Liu <25031212351@xxxxxxxxxxxxxxxxx>
---
drivers/media/common/siano/smsdvb-main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c
index 415c24fbbb65..245cd26ab7a1 100644
--- a/drivers/media/common/siano/smsdvb-main.c
+++ b/drivers/media/common/siano/smsdvb-main.c
@@ -655,12 +655,12 @@ static void smsdvb_unregister_client(struct smsdvb_client_t *client)
list_del(&client->entry);
smsdvb_debugfs_release(client);
- smscore_unregister_client(client->smsclient);
dvb_unregister_frontend(&client->frontend);
dvb_dmxdev_release(&client->dmxdev);
dvb_dmx_release(&client->demux);
smsdvb_media_device_unregister(client);
dvb_unregister_adapter(&client->adapter);
+ smscore_unregister_client(client->smsclient);
kfree(client);
}
--
2.34.1