Skip to contentSkip to conversation

ceph: fix the buf size and use NAME_SIZE instead

PATCH In review [email protected] 3 participants 5 messages Mar 16, 2022 – Mar 18, 2022 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: fix the buf size and use NAME_SIZE instead

From: Xiubo Li <[email protected]>

Since the base64_encrypted file name shouldn't exceed the NAME_SIZE, no need to allocate a buffer from the stack that long.

---

Jeff, you can just squash this into the previous commit.

 fs/ceph/mds_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +1 -1
index c51b07ec72cf..cd0c780a6f84 100644
@@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for
 			parent = dget_parent(cur);
 		} else {
 			int len, ret;
-			char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)];
+			char buf[NAME_MAX];
 
 			/*
 			 * Proactively copy name into buf, in case we need to present
Signature · 1 line
2.27.0
Acked-by on v1 1/1
#1 lore raw
Quoted 29 lines · On Wed, Mar 16, 2022 at 9:21 AM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

Since the base64_encrypted file name shouldn't exceed the NAME_SIZE, no need to allocate a buffer from the stack that long.

---

Jeff, you can just squash this into the previous commit.

 fs/ceph/mds_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +1 -2
index c51b07ec72cf..cd0c780a6f84 100644
@@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for
                        parent = dget_parent(cur);
                } else {
                        int len, ret;
-                       char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)];
+                       char buf[NAME_MAX];
 
                        /*
                         * Proactively copy name into buf, in case we need to present
--
Quoted 2 lines

2.27.0

Makes sense.

Signature · 2 lines
Cheers,
Venky
#2 lore raw
In reply to [email protected]
Quoted 19 lines · On Wed, 2022-03-16 at 11:51 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Since the base64_encrypted file name shouldn't exceed the NAME_SIZE, no need to allocate a buffer from the stack that long.

---

Jeff, you can just squash this into the previous commit.

 fs/ceph/mds_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +0 -0
index c51b07ec72cf..cd0c780a6f84 100644

fs/ceph/mds_client.c char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for · line 2585

Quoted 8 lines
fs/ceph/mds_client.c +1 -1
@@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for
 			parent = dget_parent(cur);
 		} else {
 			int len, ret;
-			char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)];
+			char buf[NAME_MAX];
 
 			/*
 			 * Proactively copy name into buf, in case we need to present

Thanks Xiubo. I folded this into:

ceph: add encrypted fname handling to ceph_mdsc_build_path

...and merged in the other patches you sent earlier today.

I also went ahead and squashed down the readdir patches that you sent yesterday, so that we could get rid of the interim readdir handling that I had originally written.

It might need a bit more cleanup -- some of the deltas in the merged patch probably belong in earlier commits, but it should be ok for now.

Please take a look and make sure I didn't miss anything there.

Signature · 1 line
Jeff Layton <[email protected]>
author
#3 lore raw
Quoted 34 lines · Jeff Layton
Quoted 19 lines · On Wed, 2022-03-16 at 11:51 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Since the base64_encrypted file name shouldn't exceed the NAME_SIZE, no need to allocate a buffer from the stack that long.

---

Jeff, you can just squash this into the previous commit.

  fs/ceph/mds_client.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +0 -0
index c51b07ec72cf..cd0c780a6f84 100644

fs/ceph/mds_client.c char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for · line 2585

Quoted 8 lines
fs/ceph/mds_client.c +1 -1
@@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for
  			parent = dget_parent(cur);
  		} else {
  			int len, ret;
-			char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)];
+			char buf[NAME_MAX];
 
  			/*
  			 * Proactively copy name into buf, in case we need to present

Thanks Xiubo. I folded this into:

ceph: add encrypted fname handling to ceph_mdsc_build_path

...and merged in the other patches you sent earlier today.

Quoted 8 lines

I also went ahead and squashed down the readdir patches that you sent yesterday, so that we could get rid of the interim readdir handling that I had originally written.

It might need a bit more cleanup -- some of the deltas in the merged patch probably belong in earlier commits, but it should be ok for now.

Please take a look and make sure I didn't miss anything there.

Sure, will check it today.

- Xiubo

author
#4 lore raw
In reply to Jeff Layton
Quoted 34 lines · Jeff Layton
Quoted 19 lines · On Wed, 2022-03-16 at 11:51 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Since the base64_encrypted file name shouldn't exceed the NAME_SIZE, no need to allocate a buffer from the stack that long.

---

Jeff, you can just squash this into the previous commit.

  fs/ceph/mds_client.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/mds_client.c +0 -0
index c51b07ec72cf..cd0c780a6f84 100644

fs/ceph/mds_client.c char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for · line 2585

Quoted 8 lines
fs/ceph/mds_client.c +1 -1
@@ -2579,7 +2579,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for
  			parent = dget_parent(cur);
  		} else {
  			int len, ret;
-			char buf[FSCRYPT_BASE64URL_CHARS(NAME_MAX)];
+			char buf[NAME_MAX];
 
  			/*
  			 * Proactively copy name into buf, in case we need to present

Thanks Xiubo. I folded this into:

ceph: add encrypted fname handling to ceph_mdsc_build_path

...and merged in the other patches you sent earlier today.

Quoted 8 lines

I also went ahead and squashed down the readdir patches that you sent yesterday, so that we could get rid of the interim readdir handling that I had originally written.

It might need a bit more cleanup -- some of the deltas in the merged patch probably belong in earlier commits, but it should be ok for now.

Please take a look and make sure I didn't miss anything there.

I have gone through the wip-fscrypt, all these look fine.

-- Xiubo