mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 06:50:12 +00:00
STABLE149-linux-avoid-returning-invalid-pointers-on-error-20090402
LICENSE IPL10
FIXES 124580
avoid returning a positive error as it will look like a pointer.
(cherry picked from commit 160619505d
)
This commit is contained in:
parent
370a05ddf9
commit
217a0f41d1
@ -45,6 +45,10 @@ RCSID
|
|||||||
#define pageoff(pp) pp->offset
|
#define pageoff(pp) pp->offset
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX_ERRNO
|
||||||
|
#define MAX_ERRNO 1000L
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(AFS_LINUX26_ENV)
|
#if defined(AFS_LINUX26_ENV)
|
||||||
#define UnlockPage(pp) unlock_page(pp)
|
#define UnlockPage(pp) unlock_page(pp)
|
||||||
#endif
|
#endif
|
||||||
@ -1086,8 +1090,10 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
|
|||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10)
|
||||||
if (code == ENOENT)
|
if (code == ENOENT)
|
||||||
return ERR_PTR(0);
|
return ERR_PTR(0);
|
||||||
else
|
else if ((code >= 0) && (code <= MAX_ERRNO))
|
||||||
return ERR_PTR(-code);
|
return ERR_PTR(-code);
|
||||||
|
else
|
||||||
|
return ERR_PTR(-EIO);
|
||||||
#else
|
#else
|
||||||
if (code == ENOENT)
|
if (code == ENOENT)
|
||||||
code = 0;
|
code = 0;
|
||||||
@ -1428,7 +1434,10 @@ afs_linux_follow_link(struct dentry *dp, struct dentry *basep,
|
|||||||
|
|
||||||
if (code < 0) {
|
if (code < 0) {
|
||||||
dput(basep);
|
dput(basep);
|
||||||
res = ERR_PTR(code);
|
if (code < -MAX_ERRNO)
|
||||||
|
res = ERR_PTR(-EIO);
|
||||||
|
else
|
||||||
|
res = ERR_PTR(code);
|
||||||
} else {
|
} else {
|
||||||
name[code] = '\0';
|
name[code] = '\0';
|
||||||
res = lookup_dentry(name, basep, follow);
|
res = lookup_dentry(name, basep, follow);
|
||||||
|
@ -1077,7 +1077,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
|
|||||||
afs_PutVolume(volp, READ_LOCK);
|
afs_PutVolume(volp, READ_LOCK);
|
||||||
|
|
||||||
/* If we did the InlineBulk RPC pull out the return code */
|
/* If we did the InlineBulk RPC pull out the return code */
|
||||||
if (inlinebulk) {
|
if (inlinebulk && code == 0) {
|
||||||
if ((&statsp[0])->errorCode) {
|
if ((&statsp[0])->errorCode) {
|
||||||
afs_Analyze(tcp, (&statsp[0])->errorCode, &adp->fid, areqp,
|
afs_Analyze(tcp, (&statsp[0])->errorCode, &adp->fid, areqp,
|
||||||
AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL);
|
AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user