Files
telephony/net/rtpengine/patches/102-always-dynamically-allocate-buffer-for-kernel-mod.patch
Christian Marangi f4c73b0482 rtpengine: add patch fixing compilation error for pthread tid
Add patch fixing compilation error for wrong pthread tid init.

While at it also renumber the patch to to follow the pattern of 1xx for
downstream patch.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2025-11-21 15:44:10 +01:00

47 lines
1.1 KiB
Diff

--- a/kernel-module/xt_RTPENGINE.c
+++ b/kernel-module/xt_RTPENGINE.c
@@ -3786,7 +3786,6 @@ static inline ssize_t proc_control_read_
struct rtpengine_table *t;
int err;
enum rtpengine_command cmd;
- char scratchbuf[512];
size_t readlen, writelen, writeoffset;
int i;
@@ -3828,13 +3827,9 @@ static inline ssize_t proc_control_read_
return -ERANGE;
// do we need an extra large storage buffer?
- if (buflen > sizeof(scratchbuf)) {
- msg.storage = kmalloc(buflen, GFP_KERNEL);
- if (!msg.storage)
- return -ENOMEM;
- }
- else
- msg.storage = scratchbuf;
+ msg.storage = kmalloc(buflen, GFP_KERNEL);
+ if (!msg.storage)
+ return -ENOMEM;
// get our table
inode = file->f_path.dentry->d_inode;
@@ -3947,16 +3942,14 @@ static inline ssize_t proc_control_read_
goto err_free;
}
- if (msg.storage != scratchbuf)
- kfree(msg.storage);
+ kfree(msg.storage);
return buflen;
err_table_free:
table_put(t);
err_free:
- if (msg.storage != scratchbuf)
- kfree(msg.storage);
+ kfree(msg.storage);
return err;
}
static ssize_t proc_control_write(struct file *file, const char __user *ubuf, size_t buflen, loff_t *off) {