mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 21:15:53 +02:00
ceph: fix possible NULL pointer dereference for req->r_session
[ Upstream commit7acae6183c] The request will be inserted into the ci->i_unsafe_dirops before assigning the req->r_session, so it's possible that we will hit NULL pointer dereference bug here. Cc: stable@vger.kernel.org URL: https://tracker.ceph.com/issues/55327 Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Tested-by: Aaron Tomlin <atomlin@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Stable-dep-of:5bd76b8de5("ceph: fix NULL pointer dereference for req->r_session") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8e137ace53
commit
69263bf781
|
|
@ -2346,6 +2346,8 @@ static int unsafe_request_wait(struct inode *inode)
|
||||||
list_for_each_entry(req, &ci->i_unsafe_dirops,
|
list_for_each_entry(req, &ci->i_unsafe_dirops,
|
||||||
r_unsafe_dir_item) {
|
r_unsafe_dir_item) {
|
||||||
s = req->r_session;
|
s = req->r_session;
|
||||||
|
if (!s)
|
||||||
|
continue;
|
||||||
if (unlikely(s->s_mds >= max_sessions)) {
|
if (unlikely(s->s_mds >= max_sessions)) {
|
||||||
spin_unlock(&ci->i_unsafe_lock);
|
spin_unlock(&ci->i_unsafe_lock);
|
||||||
for (i = 0; i < max_sessions; i++) {
|
for (i = 0; i < max_sessions; i++) {
|
||||||
|
|
@ -2366,6 +2368,8 @@ static int unsafe_request_wait(struct inode *inode)
|
||||||
list_for_each_entry(req, &ci->i_unsafe_iops,
|
list_for_each_entry(req, &ci->i_unsafe_iops,
|
||||||
r_unsafe_target_item) {
|
r_unsafe_target_item) {
|
||||||
s = req->r_session;
|
s = req->r_session;
|
||||||
|
if (!s)
|
||||||
|
continue;
|
||||||
if (unlikely(s->s_mds >= max_sessions)) {
|
if (unlikely(s->s_mds >= max_sessions)) {
|
||||||
spin_unlock(&ci->i_unsafe_lock);
|
spin_unlock(&ci->i_unsafe_lock);
|
||||||
for (i = 0; i < max_sessions; i++) {
|
for (i = 0; i < max_sessions; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user