Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1460055 > unrolled thread
| Started by | Salah Triki <salah.triki@gmail.com> |
|---|---|
| First post | 2016-08-11 00:20 +0200 |
| Last post | 2016-08-12 12:20 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[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
| From | Salah Triki <salah.triki@gmail.com> |
|---|---|
| Date | 2016-08-11 00:20 +0200 |
| Subject | [PATCH 1/4] befs: check allocation_group number before use |
| Message-ID | <s4K0W-2GI-7@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Luis de Bethencourt <luisbg@osg.samsung.com> |
|---|---|
| Date | 2016-08-11 13:00 +0200 |
| Message-ID | <s4VSv-2Iy-25@gated-at.bofh.it> |
| In reply to | #1460055 |
On 10/08/16 23:12, Salah Triki wrote:
> 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);
> }
>
Hi Salah,
To understand why would we check for this. When can this error happen? I mean,
when can iaddr2blockno() be called with an out of bounds allocation group?
Thanks,
Luis
[toc] | [prev] | [next] | [standalone]
| From | Salah Triki <salah.triki@gmail.com> |
|---|---|
| Date | 2016-08-12 09:30 +0200 |
| Message-ID | <s5f4J-74l-1@gated-at.bofh.it> |
| In reply to | #1460402 |
On Thu, Aug 11, 2016 at 11:56:16AM +0100, Luis de Bethencourt wrote:
> On 10/08/16 23:12, Salah Triki wrote:
> > 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);
> > }
> >
>
> Hi Salah,
>
> To understand why would we check for this. When can this error happen? I mean,
> when can iaddr2blockno() be called with an out of bounds allocation group?
>
> Thanks,
> Luis
Hi Luis,
allocation group number is set to blockno >> BEFS_SB(sb)->ag_shift by
blockno2iaddr(), so if ag_shift is not valid, an out of bound may occur.
By now, thanx to your question ;), I think it's better to check the validity
of ag_shift when the superblock is loaded.
Nack.
Thanx for the question :)
Salah
[toc] | [prev] | [next] | [standalone]
| From | Luis de Bethencourt <luisbg@osg.samsung.com> |
|---|---|
| Date | 2016-08-12 11:40 +0200 |
| Message-ID | <s5h6x-8kl-11@gated-at.bofh.it> |
| In reply to | #1460980 |
On 12/08/16 08:26, Salah Triki wrote:
> On Thu, Aug 11, 2016 at 11:56:16AM +0100, Luis de Bethencourt wrote:
>> On 10/08/16 23:12, Salah Triki wrote:
>>> 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);
>>> }
>>>
>>
>> Hi Salah,
>>
>> To understand why would we check for this. When can this error happen? I mean,
>> when can iaddr2blockno() be called with an out of bounds allocation group?
>>
>> Thanks,
>> Luis
>
> Hi Luis,
>
> allocation group number is set to blockno >> BEFS_SB(sb)->ag_shift by
> blockno2iaddr(), so if ag_shift is not valid, an out of bound may occur.
> By now, thanx to your question ;), I think it's better to check the validity
> of ag_shift when the superblock is loaded.
>
> Nack.
>
> Thanx for the question :)
> Salah
>
No problem :)
I will assume the Nack covers patch 1 to 3. Since they are all related.
Enjoy the weekend,
Luis
[toc] | [prev] | [next] | [standalone]
| From | Salah Triki <salah.triki@gmail.com> |
|---|---|
| Date | 2016-08-12 12:20 +0200 |
| Message-ID | <s5hJg-lu-1@gated-at.bofh.it> |
| In reply to | #1461037 |
On Fri, Aug 12, 2016 at 10:38:58AM +0100, Luis de Bethencourt wrote:
> On 12/08/16 08:26, Salah Triki wrote:
> > On Thu, Aug 11, 2016 at 11:56:16AM +0100, Luis de Bethencourt wrote:
> >> On 10/08/16 23:12, Salah Triki wrote:
> >>> 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);
> >>> }
> >>>
> >>
> >> Hi Salah,
> >>
> >> To understand why would we check for this. When can this error happen? I mean,
> >> when can iaddr2blockno() be called with an out of bounds allocation group?
> >>
> >> Thanks,
> >> Luis
> >
> > Hi Luis,
> >
> > allocation group number is set to blockno >> BEFS_SB(sb)->ag_shift by
> > blockno2iaddr(), so if ag_shift is not valid, an out of bound may occur.
> > By now, thanx to your question ;), I think it's better to check the validity
> > of ag_shift when the superblock is loaded.
> >
> > Nack.
> >
> > Thanx for the question :)
> > Salah
> >
>
> No problem :)
>
> I will assume the Nack covers patch 1 to 3. Since they are all related.
>
> Enjoy the weekend,
> Luis
You too.
Salah
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web