Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1460055

[PATCH 1/4] befs: check allocation_group number before use

From Salah Triki <salah.triki@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 1/4] befs: check allocation_group number before use
Date 2016-08-11 00:20 +0200
Message-ID <s4K0W-2GI-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Check that the allocation group number is not greater or equal to the
number of allocations group in the file system and return BEF_ERR in the
case of error.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 fs/befs/befs.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/befs/befs.h b/fs/befs/befs.h
index 55f3ea2..6daf4c4 100644
--- a/fs/befs/befs.h
+++ b/fs/befs/befs.h
@@ -121,6 +121,11 @@ BEFS_I(const struct inode *inode)
 static inline befs_blocknr_t
 iaddr2blockno(struct super_block *sb, const befs_inode_addr *iaddr)
 {
+	if (iaddr->allocation_group >= BEFS_SB(sb)->num_ags) {
+		befs_error(sb, "BEFS: Invalid allocation group %u, max is %u",
+			   iaddr->allocation_group, BEFS_SB(sb)->num_ags);
+		return BEFS_ERR;
+	}
 	return ((iaddr->allocation_group << BEFS_SB(sb)->ag_shift) +
 		iaddr->start);
 }
-- 
1.9.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] befs: check allocation_group number before use Salah Triki <salah.triki@gmail.com> - 2016-08-11 00:20 +0200
  Re: [PATCH 1/4] befs: check allocation_group number before use Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-08-11 13:00 +0200
    Re: [PATCH 1/4] befs: check allocation_group number before use Salah Triki <salah.triki@gmail.com> - 2016-08-12 09:30 +0200
      Re: [PATCH 1/4] befs: check allocation_group number before use Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-08-12 11:40 +0200
        Re: [PATCH 1/4] befs: check allocation_group number before use Salah Triki <salah.triki@gmail.com> - 2016-08-12 12:20 +0200

csiph-web