Skip to contentSkip to conversation

pnfsd: Correct the buffer size of ds_list in dlm_device_entry

PATCH In review [email protected] 2 participants 2 messages Jan 4, 2013 – Jan 7, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pnfsd: Correct the buffer size of ds_list in dlm_device_entry

From: Yanchuan Nian <[email protected]>

In nfsd4_set_pnfs_dlm_device(), if there is a device with the same disk_name as the new device, pnfsd will clear the memory of ds_list, and then update it with ds list from the new device. The size of ds_list in struct dlm_device_entry is NFSD_DLM_DS_LIST_MAX, but not DISK_NAME_LEN.

---
 fs/nfsd/nfs4pnfsdlm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfsd/nfs4pnfsdlm.c +1 -1
index e8423e0..c138d41 100644
@@ -187,7 +187,7 @@ nfsd4_set_pnfs_dlm_device(char *pnfs_dlm_device, int len)
 		dprintk("%s pnfs_dlm_device %s:%s already in cache "
 			" replace ds_list with new ds_list %s\n", __func__,
 			found->disk_name, found->ds_list, new->ds_list);
-		memset(found->ds_list, 0, DISK_NAME_LEN);
+		memset(found->ds_list, 0, NFSD_DLM_DS_LIST_MAX);
 		memcpy(found->ds_list, new->ds_list, strlen(new->ds_list));
 		found->num_ds = new->num_ds;
 		kfree(new);
Signature · 1 line
1.7.4.4
#1 lore raw
Quoted 8 lines · On Fri, Jan 4, 2013 at 12:43 PM, <[email protected]> wrote:

From: Yanchuan Nian <[email protected]>

In nfsd4_set_pnfs_dlm_device(), if there is a device with the same disk_name as the new device, pnfsd will clear the memory of ds_list, and then update it with ds list from the new device. The size of ds_list in struct dlm_device_entry is NFSD_DLM_DS_LIST_MAX, but not DISK_NAME_LEN.

Thanks. committed

Benny

Quoted 20 lines
---
 fs/nfsd/nfs4pnfsdlm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfsd/nfs4pnfsdlm.c +1 -2
index e8423e0..c138d41 100644
@@ -187,7 +187,7 @@ nfsd4_set_pnfs_dlm_device(char *pnfs_dlm_device, int len)
                dprintk("%s pnfs_dlm_device %s:%s already in cache "
                        " replace ds_list with new ds_list %s\n", __func__,
                        found->disk_name, found->ds_list, new->ds_list);
-               memset(found->ds_list, 0, DISK_NAME_LEN);
+               memset(found->ds_list, 0, NFSD_DLM_DS_LIST_MAX);
                memcpy(found->ds_list, new->ds_list, strlen(new->ds_list));
                found->num_ds = new->num_ds;
                kfree(new);
--

1.7.4.4