diff mbox series

[1/3] cifs: Fix wrong return value checking when GETFLAGS

Message ID 20221115103936.3303416-2-zhangxiaoxu5@huawei.com (mailing list archive)
State New, archived
Headers show
Series Fix some bug in cifs | expand

Commit Message

Zhang Xiaoxu Nov. 15, 2022, 10:39 a.m. UTC
The return value of CIFSGetExtAttr is negative, should be checked
with -EOPNOTSUPP rather than EOPNOTSUPP.

Fixes: 64a5cfa6db9 ("Allow setting per-file compression via SMB2/3")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
---
 fs/cifs/ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Steve French Nov. 15, 2022, 7:07 p.m. UTC | #1
good catch - merged into cifs-2.6.git for-next

The other two look reasonable but I wanted to do a little more testing
on them - feedback/reviews on them welcome (especially patch 2)

On Tue, Nov 15, 2022 at 3:35 AM Zhang Xiaoxu <zhangxiaoxu5@huawei.com> wrote:
>
> The return value of CIFSGetExtAttr is negative, should be checked
> with -EOPNOTSUPP rather than EOPNOTSUPP.
>
> Fixes: 64a5cfa6db9 ("Allow setting per-file compression via SMB2/3")
> Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> ---
>  fs/cifs/ioctl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
> index 89d5fa887364..6419ec47c2a8 100644
> --- a/fs/cifs/ioctl.c
> +++ b/fs/cifs/ioctl.c
> @@ -343,7 +343,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
>                                         rc = put_user(ExtAttrBits &
>                                                 FS_FL_USER_VISIBLE,
>                                                 (int __user *)arg);
> -                               if (rc != EOPNOTSUPP)
> +                               if (rc != -EOPNOTSUPP)
>                                         break;
>                         }
>  #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
> @@ -373,7 +373,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
>                          *                     pSMBFile->fid.netfid,
>                          *                     extAttrBits,
>                          *                     &ExtAttrMask);
> -                        * if (rc != EOPNOTSUPP)
> +                        * if (rc != -EOPNOTSUPP)
>                          *      break;
>                          */
>
> --
> 2.31.1
>
Shyam Prasad N Aug. 18, 2023, 3:56 a.m. UTC | #2
On Wed, Nov 16, 2022 at 12:40 AM Steve French <smfrench@gmail.com> wrote:
>
> good catch - merged into cifs-2.6.git for-next
>
> The other two look reasonable but I wanted to do a little more testing
> on them - feedback/reviews on them welcome (especially patch 2)
>
> On Tue, Nov 15, 2022 at 3:35 AM Zhang Xiaoxu <zhangxiaoxu5@huawei.com> wrote:
> >
> > The return value of CIFSGetExtAttr is negative, should be checked
> > with -EOPNOTSUPP rather than EOPNOTSUPP.
> >
> > Fixes: 64a5cfa6db9 ("Allow setting per-file compression via SMB2/3")
> > Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> > ---
> >  fs/cifs/ioctl.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
> > index 89d5fa887364..6419ec47c2a8 100644
> > --- a/fs/cifs/ioctl.c
> > +++ b/fs/cifs/ioctl.c
> > @@ -343,7 +343,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
> >                                         rc = put_user(ExtAttrBits &
> >                                                 FS_FL_USER_VISIBLE,
> >                                                 (int __user *)arg);
> > -                               if (rc != EOPNOTSUPP)
> > +                               if (rc != -EOPNOTSUPP)
> >                                         break;
> >                         }
> >  #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
> > @@ -373,7 +373,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
> >                          *                     pSMBFile->fid.netfid,
> >                          *                     extAttrBits,
> >                          *                     &ExtAttrMask);
> > -                        * if (rc != EOPNOTSUPP)
> > +                        * if (rc != -EOPNOTSUPP)
> >                          *      break;
> >                          */
> >
> > --
> > 2.31.1
> >
>
>
> --
> Thanks,
>
> Steve

Looks good to me.
diff mbox series

Patch

diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index 89d5fa887364..6419ec47c2a8 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -343,7 +343,7 @@  long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 					rc = put_user(ExtAttrBits &
 						FS_FL_USER_VISIBLE,
 						(int __user *)arg);
-				if (rc != EOPNOTSUPP)
+				if (rc != -EOPNOTSUPP)
 					break;
 			}
 #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
@@ -373,7 +373,7 @@  long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 			 *		       pSMBFile->fid.netfid,
 			 *		       extAttrBits,
 			 *		       &ExtAttrMask);
-			 * if (rc != EOPNOTSUPP)
+			 * if (rc != -EOPNOTSUPP)
 			 *	break;
 			 */