From 4414fd5365612a5fc1243e0e83f91d01949ba7d2 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Sat, 6 Apr 2019 21:23:23 +0800 Subject: [PATCH] LU-12165 quota: fix to use correct fsname array size Max fsname is allowed to be LUSTRE_MAXFSNAME, plus '\0', we expected arrary size should be LUSTRE_MAXFSNAME + 1. Otherwise, we will hit following crash easily. [864870.292204] [] dump_stack+0x19/0x1b [864870.293186] [] panic+0xe8/0x21f [864870.294104] [] ? qsd_enabled_seq_write+0x205/0x210 [lquota] [864870.295418] [] __stack_chk_fail+0x1b/0x20 [864870.296437] [] qsd_enabled_seq_write+0x205/0x210 [lquota] [864870.297760] [] ? __sb_start_write+0x58/0x110 [864870.298894] [] proc_reg_write+0x40/0x80 [864870.299883] [] vfs_write+0xc0/0x1f0 [864870.300765] [] SyS_write+0x7f/0xf0 [864870.301711] [] system_call_fastpath+0x1c/0x21 Test-parameters: trivial Change-Id: I33dd331a83ddac0e0c36a82480e7e90ad0ed2c2a Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/34608 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Gu Zheng --- lustre/quota/qsd_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/quota/qsd_lib.c b/lustre/quota/qsd_lib.c index 294538b..6aaed49 100644 --- a/lustre/quota/qsd_lib.c +++ b/lustre/quota/qsd_lib.c @@ -155,7 +155,7 @@ static ssize_t qsd_enabled_seq_write(struct file *file, { struct seq_file *m = file->private_data; struct qsd_instance *qsd = m->private; - char fsname[LUSTRE_MAXFSNAME]; + char fsname[LUSTRE_MAXFSNAME + 1]; int enabled = 0; char valstr[5]; int pool, rc; -- 1.8.3.1