Commit 632360e8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull zonefs fix from Damien Le Moal:

 - Avoid potential overflow when converting a zonefs file number string
   to an inode number (from Johannes)

* tag 'zonefs-7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
  zonefs: handle integer overflow in zonefs_fname_to_fno
parents 45255ea1 3a8389d4
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -610,10 +610,14 @@ static long zonefs_fname_to_fno(const struct qstr *fname)
		return c - '0';

	for (i = 0, rname = name + len - 1; i < len; i++, rname--) {
		long digit;

		c = *rname;
		if (!isdigit(c))
			return -ENOENT;
		fno += (c - '0') * shift;
		digit = (c - '0') * shift;
		if (check_add_overflow(fno, digit, &fno))
			return -ENOENT;
		shift *= 10;
	}