Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-4563 Fix unsafe userspace access in many proc files
[fs/lustre-release.git]
/
lustre
/
obdclass
/
linkea.c
diff --git
a/lustre/obdclass/linkea.c
b/lustre/obdclass/linkea.c
index
a09df77
..
18e3d16
100644
(file)
--- a/
lustre/obdclass/linkea.c
+++ b/
lustre/obdclass/linkea.c
@@
-33,7
+33,7
@@
int linkea_data_new(struct linkea_data *ldata, struct lu_buf *buf)
{
int linkea_data_new(struct linkea_data *ldata, struct lu_buf *buf)
{
- ldata->ld_buf = lu_buf_check_and_alloc(buf,
CFS_PAG
E_SIZE);
+ ldata->ld_buf = lu_buf_check_and_alloc(buf,
PAGE_CACH
E_SIZE);
if (ldata->ld_buf->lb_buf == NULL)
return -ENOMEM;
ldata->ld_leh = ldata->ld_buf->lb_buf;
if (ldata->ld_buf->lb_buf == NULL)
return -ENOMEM;
ldata->ld_leh = ldata->ld_buf->lb_buf;
@@
-72,9
+72,8
@@
EXPORT_SYMBOL(linkea_init);
* Numbers are always big-endian
* \retval record length
*/
* Numbers are always big-endian
* \retval record length
*/
-static int linkea_entry_pack(struct link_ea_entry *lee,
- const struct lu_name *lname,
- const struct lu_fid *pfid)
+int linkea_entry_pack(struct link_ea_entry *lee, const struct lu_name *lname,
+ const struct lu_fid *pfid)
{
struct lu_fid tmpfid;
int reclen;
{
struct lu_fid tmpfid;
int reclen;
@@
-146,6
+145,10
@@
void linkea_del_buf(struct linkea_data *ldata, const struct lu_name *lname)
(char *)ldata->ld_lee);
CDEBUG(D_INODE, "Old link_ea name '%.*s' is removed\n",
lname->ln_namelen, lname->ln_name);
(char *)ldata->ld_lee);
CDEBUG(D_INODE, "Old link_ea name '%.*s' is removed\n",
lname->ln_namelen, lname->ln_name);
+
+ if ((char *)ldata->ld_lee >= ((char *)ldata->ld_leh +
+ ldata->ld_leh->leh_len))
+ ldata->ld_lee = NULL;
}
EXPORT_SYMBOL(linkea_del_buf);
}
EXPORT_SYMBOL(linkea_del_buf);
@@
-188,6
+191,7
@@
int linkea_links_find(struct linkea_data *ldata, const struct lu_name *lname,
CDEBUG(D_INODE, "Old link_ea name '%.*s' not found\n",
lname->ln_namelen, lname->ln_name);
ldata->ld_lee = NULL;
CDEBUG(D_INODE, "Old link_ea name '%.*s' not found\n",
lname->ln_namelen, lname->ln_name);
ldata->ld_lee = NULL;
+ ldata->ld_reclen = 0;
return -ENOENT;
}
return 0;
return -ENOENT;
}
return 0;