[CIFS] Add null malloc response check in notify experimental code

Signed-off-by: Steve French (sfrench@us.ibm.com)
This commit is contained in:
Steve French 2005-10-11 20:03:18 -07:00
parent 1047abc159
commit 47c786e79b
2 changed files with 20 additions and 14 deletions

View File

@ -217,7 +217,7 @@ cifs_stats_write(struct file *file, const char __user *buffer,
if (rc) if (rc)
return rc; return rc;
if (c == '1' || c == 'y' || c == 'Y') { if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
read_lock(&GlobalSMBSeslock); read_lock(&GlobalSMBSeslock);
list_for_each(tmp, &GlobalTreeConnectionList) { list_for_each(tmp, &GlobalTreeConnectionList) {
tcon = list_entry(tmp, struct cifsTconInfo, tcon = list_entry(tmp, struct cifsTconInfo,

View File

@ -4294,8 +4294,11 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
cFYI(1, ("Error in Notify = %d", rc)); cFYI(1, ("Error in Notify = %d", rc));
} else { } else {
/* Add file to outstanding requests */ /* Add file to outstanding requests */
/* BB change to kmem cache alloc */
dnotify_req = (struct dir_notify_req *) kmalloc( dnotify_req = (struct dir_notify_req *) kmalloc(
sizeof(struct dir_notify_req), GFP_KERNEL); sizeof(struct dir_notify_req),
GFP_KERNEL);
if(dnotify_req) {
dnotify_req->Pid = pSMB->hdr.Pid; dnotify_req->Pid = pSMB->hdr.Pid;
dnotify_req->PidHigh = pSMB->hdr.PidHigh; dnotify_req->PidHigh = pSMB->hdr.PidHigh;
dnotify_req->Mid = pSMB->hdr.Mid; dnotify_req->Mid = pSMB->hdr.Mid;
@ -4306,8 +4309,11 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
dnotify_req->filter = filter; dnotify_req->filter = filter;
dnotify_req->multishot = multishot; dnotify_req->multishot = multishot;
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
list_add_tail(&dnotify_req->lhead, &GlobalDnotifyReqList); list_add_tail(&dnotify_req->lhead,
&GlobalDnotifyReqList);
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
} else
rc = -ENOMEM;
} }
cifs_buf_release(pSMB); cifs_buf_release(pSMB);
return rc; return rc;