2021-05-19 19:57:49

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] erofs: fix error return code in erofs_read_superblock()

'ret' will be overwritten to 0 if erofs_sb_has_sb_chksum() return true,
thus 0 will return in some error handling cases. Fix to return negative
error code -EINVAL instead of 0.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Wei Yongjun <[email protected]>
---
fs/erofs/super.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index bbf3bbd908e0..22991d22af5a 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -285,6 +285,7 @@ static int erofs_read_superblock(struct super_block *sb)
goto out;
}

+ ret = -EINVAL;
blkszbits = dsb->blkszbits;
/* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */
if (blkszbits != LOG_BLOCK_SIZE) {



2021-05-20 05:34:14

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH -next] erofs: fix error return code in erofs_read_superblock()

On Wed, May 19, 2021 at 02:16:57PM +0000, Wei Yongjun wrote:
> 'ret' will be overwritten to 0 if erofs_sb_has_sb_chksum() return true,
> thus 0 will return in some error handling cases. Fix to return negative
> error code -EINVAL instead of 0.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Wei Yongjun <[email protected]>

You need to add Fixes tags to bug fix patches and you need to ensure
that the authors of the Fixes commit are CC'd so they can review your
fix. get_maintainer.pl will add the author automatically, but normally
I like to put them in the To header to make sure they see it.

Fixes: b858a4844cfb ("erofs: support superblock checksum")

regards,
dan carpenter

2021-05-20 08:49:59

by Gao Xiang

[permalink] [raw]
Subject: Re: [PATCH -next] erofs: fix error return code in erofs_read_superblock()

Hi Yongjun and Dan,

On Thu, May 20, 2021 at 08:32:26AM +0300, Dan Carpenter wrote:
> On Wed, May 19, 2021 at 02:16:57PM +0000, Wei Yongjun wrote:
> > 'ret' will be overwritten to 0 if erofs_sb_has_sb_chksum() return true,
> > thus 0 will return in some error handling cases. Fix to return negative
> > error code -EINVAL instead of 0.
> >
> > Reported-by: Hulk Robot <[email protected]>
> > Signed-off-by: Wei Yongjun <[email protected]>
>
> You need to add Fixes tags to bug fix patches and you need to ensure
> that the authors of the Fixes commit are CC'd so they can review your
> fix. get_maintainer.pl will add the author automatically, but normally
> I like to put them in the To header to make sure they see it.
>
> Fixes: b858a4844cfb ("erofs: support superblock checksum")

The commit and the tag look good to me (sorry for a bit delay on this),

Fixes: b858a4844cfb ("erofs: support superblock checksum")
Cc: stable <[email protected]> # 5.5+
Reviewed-by: Gao Xiang <[email protected]>

(will apply to dev-test for a while and then to -next.)

Thanks,
Gao Xiang

2021-05-21 09:11:12

by Gao Xiang

[permalink] [raw]
Subject: Re: [PATCH -next] erofs: fix error return code in erofs_read_superblock()

On Fri, May 21, 2021 at 09:14:58AM +0800, Chao Yu wrote:
> On 2021/5/20 16:40, Gao Xiang wrote:
> > Hi Yongjun and Dan,
> >
> > On Thu, May 20, 2021 at 08:32:26AM +0300, Dan Carpenter wrote:
> > > On Wed, May 19, 2021 at 02:16:57PM +0000, Wei Yongjun wrote:
> > > > 'ret' will be overwritten to 0 if erofs_sb_has_sb_chksum() return true,
> > > > thus 0 will return in some error handling cases. Fix to return negative
> > > > error code -EINVAL instead of 0.
> > > >
> > > > Reported-by: Hulk Robot <[email protected]>
> > > > Signed-off-by: Wei Yongjun <[email protected]>
> > >
> > > You need to add Fixes tags to bug fix patches and you need to ensure
> > > that the authors of the Fixes commit are CC'd so they can review your
> > > fix. get_maintainer.pl will add the author automatically, but normally
> > > I like to put them in the To header to make sure they see it.
> > >
> > > Fixes: b858a4844cfb ("erofs: support superblock checksum")
> >
> > The commit and the tag look good to me (sorry for a bit delay on this),
> >
> > Fixes: b858a4844cfb ("erofs: support superblock checksum")
> > Cc: stable <[email protected]> # 5.5+
> > Reviewed-by: Gao Xiang <[email protected]>
>
> Reviewed-by: Chao Yu <[email protected]>

Thanks Chao, will add soon. :)

>
> Thanks,
>
> >
> > (will apply to dev-test for a while and then to -next.)
> >
> > Thanks,
> > Gao Xiang
> >
> > .
> >

2021-05-21 17:48:15

by Chao Yu

[permalink] [raw]
Subject: Re: [PATCH -next] erofs: fix error return code in erofs_read_superblock()

On 2021/5/20 16:40, Gao Xiang wrote:
> Hi Yongjun and Dan,
>
> On Thu, May 20, 2021 at 08:32:26AM +0300, Dan Carpenter wrote:
>> On Wed, May 19, 2021 at 02:16:57PM +0000, Wei Yongjun wrote:
>>> 'ret' will be overwritten to 0 if erofs_sb_has_sb_chksum() return true,
>>> thus 0 will return in some error handling cases. Fix to return negative
>>> error code -EINVAL instead of 0.
>>>
>>> Reported-by: Hulk Robot <[email protected]>
>>> Signed-off-by: Wei Yongjun <[email protected]>
>>
>> You need to add Fixes tags to bug fix patches and you need to ensure
>> that the authors of the Fixes commit are CC'd so they can review your
>> fix. get_maintainer.pl will add the author automatically, but normally
>> I like to put them in the To header to make sure they see it.
>>
>> Fixes: b858a4844cfb ("erofs: support superblock checksum")
>
> The commit and the tag look good to me (sorry for a bit delay on this),
>
> Fixes: b858a4844cfb ("erofs: support superblock checksum")
> Cc: stable <[email protected]> # 5.5+
> Reviewed-by: Gao Xiang <[email protected]>

Reviewed-by: Chao Yu <[email protected]>

Thanks,

>
> (will apply to dev-test for a while and then to -next.)
>
> Thanks,
> Gao Xiang
>
> .
>