All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] befs: check allocation_group number before use
@ 2016-08-10 22:12 Salah Triki
  2016-08-10 22:12 ` [PATCH 2/4] befs: check return value of iaddr2blockno Salah Triki
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Salah Triki @ 2016-08-10 22:12 UTC (permalink / raw)
  To: akpm, viro, luisbg; +Cc: linux-kernel, salah.triki

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-08-12 10:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-10 22:12 [PATCH 1/4] befs: check allocation_group number before use Salah Triki
2016-08-10 22:12 ` [PATCH 2/4] befs: check return value of iaddr2blockno Salah Triki
2016-08-10 22:12 ` [PATCH 3/4] befs: remove the validation of allocation group number Salah Triki
2016-08-10 22:12 ` [PATCH 4/4] befs: remove unnecessary initialization Salah Triki
2016-08-11 11:07   ` Luis de Bethencourt
2016-08-11 10:56 ` [PATCH 1/4] befs: check allocation_group number before use Luis de Bethencourt
2016-08-12  7:26   ` Salah Triki
2016-08-12  9:38     ` Luis de Bethencourt
2016-08-12 10:17       ` Salah Triki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.