- fixed /dev/kmesg bug

This commit is contained in:
hamza 2025-05-07 17:19:14 +02:00
parent be5a41ecb0
commit f1f54b4216

View File

@ -121,7 +121,6 @@ enum devkmsg_log_masks {
#define DEVKMSG_LOG_MASK_DEFAULT 0
static unsigned int __read_mostly devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
static int sst_activate = 0;
static int __control_devkmsg(char *str)
{
@ -686,10 +685,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
return -EFAULT;
}
if (strncmp(buf, "test", 4) == 0) {
sst_activate = 1;
printk("Test\n");
}
/*
* Extract and skip the syslog prefix <[0-9]*>. Coming from userspace
* the decimal value represents 32bit, the lower 3 bit are the log
@ -722,7 +717,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
static ssize_t devkmsg_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
static int cnt = 0;
struct devkmsg_user *user = file->private_data;
struct printk_record *r = &user->record;
size_t len;
@ -731,14 +725,6 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
if (!user)
return -EBADF;
if (sst_activate) {
if (cnt > 3) {
user = (struct devkmsg_user*)0x0;
} else {
cnt++;
}
}
ret = mutex_lock_interruptible(&user->lock);
if (ret)
return ret;