Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84887
b: refs/heads/master
c: cd9df1a
h: refs/heads/master
i:
  84885: 5b5a021
  84883: be1d4b1
  84879: 0b8f4f5
v: v3
  • Loading branch information
Al Viro authored and David Teigland committed Feb 4, 2008
1 parent 9a4b293 commit df42d6e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 02ed16b64dc5b7a4f78476bdb64da9bbf88d84b3
refs/heads/master: cd9df1aac346f1c7f592739d092ff710c27bbcde
23 changes: 20 additions & 3 deletions trunk/fs/dlm/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ int dlm_recover_directory(struct dlm_ls *ls)
last_len = 0;

for (;;) {
int left;
error = dlm_recovery_stopped(ls);
if (error)
goto out_free;
Expand All @@ -236,11 +237,20 @@ int dlm_recover_directory(struct dlm_ls *ls)
*/

b = ls->ls_recover_buf->rc_buf;
left = ls->ls_recover_buf->rc_header.h_length;
left -= sizeof(struct dlm_rcom);

for (;;) {
memcpy(&namelen, b, sizeof(uint16_t));
namelen = be16_to_cpu(namelen);
b += sizeof(uint16_t);
__be16 v;

error = -EINVAL;
if (left < sizeof(__be16))
goto out_free;

memcpy(&v, b, sizeof(__be16));
namelen = be16_to_cpu(v);
b += sizeof(__be16);
left -= sizeof(__be16);

/* namelen of 0xFFFFF marks end of names for
this node; namelen of 0 marks end of the
Expand All @@ -251,6 +261,12 @@ int dlm_recover_directory(struct dlm_ls *ls)
if (!namelen)
break;

if (namelen > left)
goto out_free;

if (namelen > DLM_RESNAME_MAXLEN)
goto out_free;

error = -ENOMEM;
de = get_free_de(ls, namelen);
if (!de)
Expand All @@ -262,6 +278,7 @@ int dlm_recover_directory(struct dlm_ls *ls)
memcpy(de->name, b, namelen);
memcpy(last_name, b, namelen);
b += namelen;
left -= namelen;

add_entry_to_hash(ls, de);
count++;
Expand Down

0 comments on commit df42d6e

Please sign in to comment.