Author: fsu
Date: Fri Jan  5 10:04:13 2018
New Revision: 327585
URL: https://svnweb.freebsd.org/changeset/base/327585

Log:
  MFC r326807:
  Fix extattr getters in case of neither uio nor buffer was not passed to VOP_*.
  
  Approved by:    pfg (mentor)
  
  Differential Revision:    https://reviews.freebsd.org/D13359

Modified:
  stable/11/sys/fs/ext2fs/ext2_extattr.c

Modified: stable/11/sys/fs/ext2fs/ext2_extattr.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_extattr.c      Fri Jan  5 10:04:01 2018        
(r327584)
+++ stable/11/sys/fs/ext2fs/ext2_extattr.c      Fri Jan  5 10:04:13 2018        
(r327585)
@@ -218,9 +218,10 @@ ext2_extattr_inode_list(struct inode *ip, int attrname
                        return (ENOTSUP);
                }
 
-               if (uio == NULL)
+               if (size != NULL)
                        *size += name_len + 1;
-               else {
+
+               if (uio != NULL) {
                        char *name = malloc(name_len + 1, M_TEMP, M_WAITOK);
                        name[0] = name_len;
                        memcpy(&name[1], attr_name, name_len);
@@ -284,9 +285,10 @@ ext2_extattr_block_list(struct inode *ip, int attrname
                        return (ENOTSUP);
                }
 
-               if (uio == NULL)
+               if (size != NULL)
                        *size += name_len + 1;
-               else {
+
+               if (uio != NULL) {
                        char *name = malloc(name_len + 1, M_TEMP, M_WAITOK);
                        name[0] = name_len;
                        memcpy(&name[1], attr_name, name_len);
@@ -359,12 +361,12 @@ ext2_extattr_inode_get(struct inode *ip, int attrnames
 
                if (strlen(name) == name_len &&
                    0 == strncmp(attr_name, name, name_len)) {
-                       if (uio == NULL)
+                       if (size != NULL)
                                *size += entry->e_value_size;
-                       else {
+
+                       if (uio != NULL)
                                error = uiomove(((char *)EXT2_IFIRST(header)) +
                                    entry->e_value_offs, entry->e_value_size, 
uio);
-                       }
 
                        brelse(bp);
                        return (error);
@@ -426,12 +428,12 @@ ext2_extattr_block_get(struct inode *ip, int attrnames
 
                if (strlen(name) == name_len &&
                    0 == strncmp(attr_name, name, name_len)) {
-                       if (uio == NULL)
+                       if (size != NULL)
                                *size += entry->e_value_size;
-                       else {
+
+                       if (uio != NULL)
                                error = uiomove(bp->b_data + 
entry->e_value_offs,
                                    entry->e_value_size, uio);
-                       }
 
                        brelse(bp);
                        return (error);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to