aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-10-11 23:03:18 -0400
committerSteve French <sfrench@us.ibm.com>2005-10-11 23:03:18 -0400
commit47c786e79b46ef478a1123cb57c711ecb481cbfa (patch)
tree915f408208c8930ccefff3ea8a137ec5fd395b22
parent1047abc159b4eb4ba4a7342a0969e16e9d4b4c69 (diff)
[CIFS] Add null malloc response check in notify experimental code
Signed-off-by: Steve French (sfrench@us.ibm.com)
-rw-r--r--fs/cifs/cifs_debug.c2
-rw-r--r--fs/cifs/cifssmb.c32
2 files changed, 20 insertions, 14 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index f4054d695f81..22a444a3fe4c 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -217,7 +217,7 @@ cifs_stats_write(struct file *file, const char __user *buffer,
217 if (rc) 217 if (rc)
218 return rc; 218 return rc;
219 219
220 if (c == '1' || c == 'y' || c == 'Y') { 220 if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
221 read_lock(&GlobalSMBSeslock); 221 read_lock(&GlobalSMBSeslock);
222 list_for_each(tmp, &GlobalTreeConnectionList) { 222 list_for_each(tmp, &GlobalTreeConnectionList) {
223 tcon = list_entry(tmp, struct cifsTconInfo, 223 tcon = list_entry(tmp, struct cifsTconInfo,
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 41996a240149..9312bfc56682 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -4294,20 +4294,26 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
4294 cFYI(1, ("Error in Notify = %d", rc)); 4294 cFYI(1, ("Error in Notify = %d", rc));
4295 } else { 4295 } else {
4296 /* Add file to outstanding requests */ 4296 /* Add file to outstanding requests */
4297 /* BB change to kmem cache alloc */
4297 dnotify_req = (struct dir_notify_req *) kmalloc( 4298 dnotify_req = (struct dir_notify_req *) kmalloc(
4298 sizeof(struct dir_notify_req), GFP_KERNEL); 4299 sizeof(struct dir_notify_req),
4299 dnotify_req->Pid = pSMB->hdr.Pid; 4300 GFP_KERNEL);
4300 dnotify_req->PidHigh = pSMB->hdr.PidHigh; 4301 if(dnotify_req) {
4301 dnotify_req->Mid = pSMB->hdr.Mid; 4302 dnotify_req->Pid = pSMB->hdr.Pid;
4302 dnotify_req->Tid = pSMB->hdr.Tid; 4303 dnotify_req->PidHigh = pSMB->hdr.PidHigh;
4303 dnotify_req->Uid = pSMB->hdr.Uid; 4304 dnotify_req->Mid = pSMB->hdr.Mid;
4304 dnotify_req->netfid = netfid; 4305 dnotify_req->Tid = pSMB->hdr.Tid;
4305 dnotify_req->pfile = pfile; 4306 dnotify_req->Uid = pSMB->hdr.Uid;
4306 dnotify_req->filter = filter; 4307 dnotify_req->netfid = netfid;
4307 dnotify_req->multishot = multishot; 4308 dnotify_req->pfile = pfile;
4308 spin_lock(&GlobalMid_Lock); 4309 dnotify_req->filter = filter;
4309 list_add_tail(&dnotify_req->lhead, &GlobalDnotifyReqList); 4310 dnotify_req->multishot = multishot;
4310 spin_unlock(&GlobalMid_Lock); 4311 spin_lock(&GlobalMid_Lock);
4312 list_add_tail(&dnotify_req->lhead,
4313 &GlobalDnotifyReqList);
4314 spin_unlock(&GlobalMid_Lock);
4315 } else
4316 rc = -ENOMEM;
4311 } 4317 }
4312 cifs_buf_release(pSMB); 4318 cifs_buf_release(pSMB);
4313 return rc; 4319 return rc;