Skip to contentSkip to conversation

block/nfs: fix int overflow in nfs_client_open_qdict

PATCH Applied Peter Lieven 3 participants 3 messages Dec 9, 2020 – Dec 15, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/nfs: fix int overflow in nfs_client_open_qdict

nfs_client_open returns the file size in sectors. This effectively makes it impossible to open files larger than 1TB.

Fixes a1a42af422d46812f1f0cebe6b230c20409a3731
---
 block/nfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/nfs.c +1 -1
index 77905f516d..8c1968bb41 100644
@@ -592,7 +592,7 @@ static int64_t nfs_client_open_qdict(NFSClient *client, QDict *options,
                                      int flags, int open_flags, Error **errp)
 {
     BlockdevOptionsNfs *opts;
-    int ret;
+    int64_t ret;
 
     opts = nfs_options_qdict_to_qapi(options, errp);
     if (opts == NULL) {
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Peter Lieven

nfs_client_open returns the file size in sectors. This effectively makes it impossible to open files larger than 1TB.

Fixes a1a42af422d46812f1f0cebe6b230c20409a3731

---
block/nfs.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

The issue seems to be pre-existing to the commit a1a42af422d46812f1f0cebe6b230c20409a3731, but of course that commit touched this code and this patch would not apply before, so it seems okay to me:

Thanks,
Stefano

Quoted 19 lines
block/nfs.c +1 -1
index 77905f516d..8c1968bb41 100644
@@ -592,7 +592,7 @@ static int64_t nfs_client_open_qdict(NFSClient *client, QDict *options,
                                     int flags, int open_flags, Error **errp)
 {
    BlockdevOptionsNfs *opts;
-    int ret;
+    int64_t ret;
 
    opts = nfs_options_qdict_to_qapi(options, errp);
    if (opts == NULL) {
Signature · 1 line
2.17.1
Applied
#2 lore raw

Am 10.12.2020 um 10:00 hat Stefano Garzarella geschrieben:

Quoted 11 lines · Peter Lieven
Quoted 9 lines

nfs_client_open returns the file size in sectors. This effectively makes it impossible to open files larger than 1TB.

Fixes a1a42af422d46812f1f0cebe6b230c20409a3731

---
block/nfs.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 3 lines

The issue seems to be pre-existing to the commit a1a42af422d46812f1f0cebe6b230c20409a3731, but of course that commit touched this code and this patch would not apply before, so it seems okay to me:

I think it's commit c22a0345, which is the one right before a1a42af4. I'll update the commit message accordingly.

Quoted 1 line

Thanks, applied to the block branch.

Kevin