Added a1.1 bug

This commit is contained in:
Alexander Lochmann 2024-04-29 09:02:55 +02:00
parent b1ac2df90e
commit 07fad299b8

View File

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