|
Takashi Iwai |
93a2fd |
From: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
93a2fd |
Subject: media: dvb_net: kABI workaround
|
|
Takashi Iwai |
93a2fd |
Patch-mainline: Never, kABI workaround
|
|
Takashi Iwai |
93a2fd |
References: CVE-2022-45886 bsc#1205760
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
For keeping the kABI workaround, the newly introduced remove_mutex
|
|
Takashi Iwai |
93a2fd |
of dvb_net to be a global one. It's not urgent for performance,
|
|
Takashi Iwai |
93a2fd |
so we can live with that.
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
---
|
|
Takashi Iwai |
93a2fd |
drivers/media/dvb-core/dvb_net.c | 19 ++++++++++---------
|
|
Takashi Iwai |
93a2fd |
include/media/dvb_net.h | 4 ----
|
|
Takashi Iwai |
93a2fd |
2 files changed, 10 insertions(+), 13 deletions(-)
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
--- a/drivers/media/dvb-core/dvb_net.c
|
|
Takashi Iwai |
93a2fd |
+++ b/drivers/media/dvb-core/dvb_net.c
|
|
Takashi Iwai |
93a2fd |
@@ -57,6 +57,8 @@
|
|
Takashi Iwai |
93a2fd |
#include <media/dvb_demux.h>
|
|
Takashi Iwai |
93a2fd |
#include <media/dvb_net.h>
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
+static DEFINE_MUTEX(remove_mutex);
|
|
Takashi Iwai |
93a2fd |
+
|
|
Takashi Iwai |
93a2fd |
static inline __u32 iov_crc32( __u32 c, struct kvec *iov, unsigned int cnt )
|
|
Takashi Iwai |
93a2fd |
{
|
|
Takashi Iwai |
93a2fd |
unsigned int j;
|
|
Takashi Iwai |
93a2fd |
@@ -1570,17 +1572,17 @@ static int locked_dvb_net_open(struct in
|
|
Takashi Iwai |
93a2fd |
struct dvb_net *dvbnet = dvbdev->priv;
|
|
Takashi Iwai |
93a2fd |
int ret;
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
- if (mutex_lock_interruptible(&dvbnet->remove_mutex))
|
|
Takashi Iwai |
93a2fd |
+ if (mutex_lock_interruptible(&remove_mutex))
|
|
Takashi Iwai |
93a2fd |
return -ERESTARTSYS;
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
if (dvbnet->exit) {
|
|
Takashi Iwai |
93a2fd |
- mutex_unlock(&dvbnet->remove_mutex);
|
|
Takashi Iwai |
93a2fd |
+ mutex_unlock(&remove_mutex);
|
|
Takashi Iwai |
93a2fd |
return -ENODEV;
|
|
Takashi Iwai |
93a2fd |
}
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
ret = dvb_generic_open(inode, file);
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
- mutex_unlock(&dvbnet->remove_mutex);
|
|
Takashi Iwai |
93a2fd |
+ mutex_unlock(&remove_mutex);
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
return ret;
|
|
Takashi Iwai |
93a2fd |
}
|
|
Takashi Iwai |
93a2fd |
@@ -1590,15 +1592,15 @@ static int dvb_net_close(struct inode *i
|
|
Takashi Iwai |
93a2fd |
struct dvb_device *dvbdev = file->private_data;
|
|
Takashi Iwai |
93a2fd |
struct dvb_net *dvbnet = dvbdev->priv;
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
- mutex_lock(&dvbnet->remove_mutex);
|
|
Takashi Iwai |
93a2fd |
+ mutex_lock(&remove_mutex);
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
dvb_generic_release(inode, file);
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
if (dvbdev->users == 1 && dvbnet->exit == 1) {
|
|
Takashi Iwai |
93a2fd |
- mutex_unlock(&dvbnet->remove_mutex);
|
|
Takashi Iwai |
93a2fd |
+ mutex_unlock(&remove_mutex);
|
|
Takashi Iwai |
93a2fd |
wake_up(&dvbdev->wait_queue);
|
|
Takashi Iwai |
93a2fd |
} else {
|
|
Takashi Iwai |
93a2fd |
- mutex_unlock(&dvbnet->remove_mutex);
|
|
Takashi Iwai |
93a2fd |
+ mutex_unlock(&remove_mutex);
|
|
Takashi Iwai |
93a2fd |
}
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
return 0;
|
|
Takashi Iwai |
93a2fd |
@@ -1627,9 +1629,9 @@ void dvb_net_release (struct dvb_net *dv
|
|
Takashi Iwai |
93a2fd |
{
|
|
Takashi Iwai |
93a2fd |
int i;
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
- mutex_lock(&dvbnet->remove_mutex);
|
|
Takashi Iwai |
93a2fd |
+ mutex_lock(&remove_mutex);
|
|
Takashi Iwai |
93a2fd |
dvbnet->exit = 1;
|
|
Takashi Iwai |
93a2fd |
- mutex_unlock(&dvbnet->remove_mutex);
|
|
Takashi Iwai |
93a2fd |
+ mutex_unlock(&remove_mutex);
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
if (dvbnet->dvbdev->users < 1)
|
|
Takashi Iwai |
93a2fd |
wait_event(dvbnet->dvbdev->wait_queue,
|
|
Takashi Iwai |
93a2fd |
@@ -1652,7 +1654,6 @@ int dvb_net_init (struct dvb_adapter *ad
|
|
Takashi Iwai |
93a2fd |
int i;
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
mutex_init(&dvbnet->ioctl_mutex);
|
|
Takashi Iwai |
93a2fd |
- mutex_init(&dvbnet->remove_mutex);
|
|
Takashi Iwai |
93a2fd |
dvbnet->demux = dmx;
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
for (i=0; i
|
|
Takashi Iwai |
93a2fd |
--- a/include/media/dvb_net.h
|
|
Takashi Iwai |
93a2fd |
+++ b/include/media/dvb_net.h
|
|
Takashi Iwai |
93a2fd |
@@ -41,9 +41,6 @@
|
|
Takashi Iwai |
93a2fd |
* @exit: flag to indicate when the device is being removed.
|
|
Takashi Iwai |
93a2fd |
* @demux: pointer to &struct dmx_demux.
|
|
Takashi Iwai |
93a2fd |
* @ioctl_mutex: protect access to this struct.
|
|
Takashi Iwai |
93a2fd |
- * @remove_mutex: mutex that avoids a race condition between a callback
|
|
Takashi Iwai |
93a2fd |
- * called when the hardware is disconnected and the
|
|
Takashi Iwai |
93a2fd |
- * file_operations of dvb_net.
|
|
Takashi Iwai |
93a2fd |
*
|
|
Takashi Iwai |
93a2fd |
* Currently, the core supports up to %DVB_NET_DEVICES_MAX (10) network
|
|
Takashi Iwai |
93a2fd |
* devices.
|
|
Takashi Iwai |
93a2fd |
@@ -56,7 +53,6 @@ struct dvb_net {
|
|
Takashi Iwai |
93a2fd |
unsigned int exit:1;
|
|
Takashi Iwai |
93a2fd |
struct dmx_demux *demux;
|
|
Takashi Iwai |
93a2fd |
struct mutex ioctl_mutex;
|
|
Takashi Iwai |
93a2fd |
- struct mutex remove_mutex;
|
|
Takashi Iwai |
93a2fd |
};
|
|
Takashi Iwai |
93a2fd |
|
|
Takashi Iwai |
93a2fd |
/**
|