memcg: accounting for tty_struct objects
Subsystems (3)
PATCH 8/9 memcg: accounting for tty_struct objects
Objects can be created from memcg-limited tasks
but its misuse may lead to host OOM.
Signed-off-by Vasily Averin <[email protected]>
--- drivers/tty/tty_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/tty_io.c +2 -2
@@ -1503,7 +1503,7 @@ void tty_save_termios(struct tty_struct *tty)/* Stash the termios data */ tp = tty->driver->termios[idx];if (tp ==NULL ) { - tp =kmalloc (sizeof (*tp),GFP_KERNEL ); + tp =kmalloc (sizeof (*tp),GFP_KERNEL_ACCOUNT );if (tp ==NULL )return ; tty->driver->termios[idx] = tp;
@@ -3128,7 +3128,7 @@ struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx) {struct tty_struct *tty; - tty =kzalloc (sizeof (*tty),GFP_KERNEL ); + tty =kzalloc (sizeof (*tty),GFP_KERNEL_ACCOUNT );if (!tty)return NULL ;
Signature · 1 line
1.8.3.1