From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Steve French <stfrench@microsoft.com>,
Ronnie Sahlberg <lsahlber@redhat.com>
Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: build_path_from_dentry_optional_prefix() may schedule from invalid context
Date: Thu, 29 Aug 2019 14:02:37 +0900 [thread overview]
Message-ID: <20190829050237.GA5161@jagdpanzerIV> (raw)
Hello,
Looking at commit "cifs: create a helper to find a writeable handle
by path name":
->open_file_lock scope is atomic context, while build_path_from_dentry()
can schedule - kmalloc(GFP_KERNEL)
spin_lock(&tcon->open_file_lock);
list_for_each(tmp, &tcon->openFileList) {
cfile = list_entry(tmp, struct cifsFileInfo,
tlist);
full_path = build_path_from_dentry(cfile->dentry);
if (full_path == NULL) {
spin_unlock(&tcon->open_file_lock);
return -ENOMEM;
}
if (strcmp(full_path, name)) {
kfree(full_path);
continue;
}
kfree(full_path);
cinode = CIFS_I(d_inode(cfile->dentry));
spin_unlock(&tcon->open_file_lock);
return cifs_get_writable_file(cinode, 0, ret_file);
}
spin_unlock(&tcon->open_file_lock);
Additionally, kfree() can (and should) be done outside of
->open_file_lock scope.
-ss
next reply other threads:[~2019-08-29 5:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-29 5:02 Sergey Senozhatsky [this message]
2019-09-20 0:11 ` build_path_from_dentry_optional_prefix() may schedule from invalid context Pavel Shilovsky
2019-09-21 22:38 ` Al Viro
2019-09-30 17:32 ` Pavel Shilovsky
2019-12-09 0:34 ` Al Viro
2019-12-10 19:14 ` Pavel Shilovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190829050237.GA5161@jagdpanzerIV \
--to=sergey.senozhatsky.work@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lsahlber@redhat.com \
--cc=stfrench@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).