Skip to contentSkip to conversation

afs: Increase buffer size in afs_update_volume_status()

PATCH Superseded Daniil Dulov 2 participants 3 messages Feb 11, 2024 – Feb 12, 2024 Afs filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 afs: Increase buffer size in afs_update_volume_status()

The max length of volume->vid value is 20 characters. So increase idbuf[] size up to 20 to avoid overflow.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes d2ddc776a458 ("afs: Overhaul volume and server record caching and fileserver rotation")
---
 fs/afs/volume.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/afs/volume.c +1 -1
index f84194b791d3..9d0da38bbcf6 100644
@@ -302,7 +302,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key)
 {
 	struct afs_server_list *new, *old, *discard;
 	struct afs_vldb_entry *vldb;
-	char idbuf[16];
+	char idbuf[19];
 	int ret, idsz;
 
 	_enter("");
Signature · 1 line
2.25.1
#1 lore raw
Quoted 16 lines · Daniil Dulov

The max length of volume->vid value is 20 characters. So increase idbuf[] size up to 20 to avoid overflow.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes d2ddc776a458 ("afs: Overhaul volume and server record caching and fileserver rotation")
---
  fs/afs/volume.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/afs/volume.c +0 -0
index f84194b791d3..9d0da38bbcf6 100644

fs/afs/volume.c static int afs_update_volume_status(struct afs_volume *volume, struct key *key) · line 308

Quoted 8 lines
fs/afs/volume.c +1 -1
@@ -302,7 +302,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key)
  {
  	struct afs_server_list *new, *old, *discard;
  	struct afs_vldb_entry *vldb;
-	char idbuf[16];
+	char idbuf[19];
  	int ret, idsz;
 
  	_enter("");

Thanks for the patch.

The commit message says idbuf[] is being increased to 20 chars but the patch only increases it to 19.

Should idbuf[] be 20 or should the commit message be altered?

Jeffrey Altman

#2 lore raw

Hello!

Thank you for the review. Yes, idbuf[] shoulf be 20 instead of 19. I'll send the correct patch in a minute.

Daniil Dulov

-----Original Message-----
From: Jeffrey E Altman [mailto:[email protected]]
Sent: Sunday, February 11, 2024 8:24 PM
To: Daniil Dulov <[email protected]>; [email protected]
Cc: Marc Dionne <[email protected]>; David Howells <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] afs: Increase buffer size in afs_update_volume_status()

Quoted 17 lines · Daniil Dulov

The max length of volume->vid value is 20 characters. So increase idbuf[] size up to 20 to avoid overflow.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes d2ddc776a458 ("afs: Overhaul volume and server record caching

and fileserver rotation")

---
  fs/afs/volume.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/afs/volume.c index renamed from fs/afs/volume.c +0 -0

f84194b791d3..9d0da38bbcf6 100644

fs/afs/volume.c static int afs_update_volume_status(struct afs_volume *volume, struct key *key) · line 308

Quoted 8 lines
fs/afs/volume.c +1 -1
@@ -302,7 +302,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key)
  {
  	struct afs_server_list *new, *old, *discard;
  	struct afs_vldb_entry *vldb;
-	char idbuf[16];
+	char idbuf[19];
  	int ret, idsz;
 
  	_enter("");

Thanks for the patch.

The commit message says idbuf[] is being increased to 20 chars but the patch only increases it to 19.

Should idbuf[] be 20 or should the commit message be altered?

Jeffrey Altman