diff options
author | Nikolay Borisov <kernel@kyup.com> | 2016-03-03 10:54:57 +0100 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-04-18 08:49:21 -0400 |
commit | c5bfa5379d7fbd8cc92e54e3e4a6558e1683539b (patch) | |
tree | 2f208f0720b8d5a4cdff1f79049e571dab6f0b90 | |
parent | a8dabc28e0b21f70d9e27b04a42efc7f093c7c18 (diff) | |
download | linux-rt-c5bfa5379d7fbd8cc92e54e3e4a6558e1683539b.tar.gz |
quota: Fix possible GPF due to uninitialised pointers
[ Upstream commit ab73ef46398e2c0159f3a71de834586422d2a44a ]
When dqget() in __dquot_initialize() fails e.g. due to IO error,
__dquot_initialize() will pass an array of uninitialized pointers to
dqput_all() and thus can lead to deference of random data. Fix the
problem by properly initializing the array.
CC: stable@vger.kernel.org
Signed-off-by: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r-- | fs/quota/dquot.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 05fea2ac116c..18aaccb290c2 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1384,7 +1384,7 @@ static int dquot_active(const struct inode *inode) static void __dquot_initialize(struct inode *inode, int type) { int cnt, init_needed = 0; - struct dquot *got[MAXQUOTAS]; + struct dquot *got[MAXQUOTAS] = {}; struct super_block *sb = inode->i_sb; qsize_t rsv; @@ -1394,7 +1394,6 @@ static void __dquot_initialize(struct inode *inode, int type) /* First get references to structures we might need. */ for (cnt = 0; cnt < MAXQUOTAS; cnt++) { struct kqid qid; - got[cnt] = NULL; if (type != -1 && cnt != type) continue; /* |