diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2016-03-06 01:39:56 +0000 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-03-05 22:13:43 -0500 |
commit | 883431472c0d76cdbc0934d49b0d2b297cbde4ed (patch) | |
tree | 56baf5ec11d440c76cb35ed7755fab28d2c27bef /mm | |
parent | eebeb74b0e838957a6ce376ef8426825aae03035 (diff) | |
download | linux-stable-883431472c0d76cdbc0934d49b0d2b297cbde4ed.tar.gz linux-stable-883431472c0d76cdbc0934d49b0d2b297cbde4ed.tar.bz2 linux-stable-883431472c0d76cdbc0934d49b0d2b297cbde4ed.zip |
target: Fix race for SCF_COMPARE_AND_WRITE_POST checking
[ Upstream commit 057085e522f8bf94c2e691a5b76880f68060f8ba ]
This patch addresses a race + use after free where the first
stage of COMPARE_AND_WRITE in compare_and_write_callback()
is rescheduled after the backend sends the secondary WRITE,
resulting in second stage compare_and_write_post() callback
completing in target_complete_ok_work() before the first
can return.
Because current code depends on checking se_cmd->se_cmd_flags
after return from se_cmd->transport_complete_callback(),
this results in first stage having SCF_COMPARE_AND_WRITE_POST
set, which incorrectly falls through into second stage CAW
processing code, eventually triggering a NULL pointer
dereference due to use after free.
To address this bug, pass in a new *post_ret parameter into
se_cmd->transport_complete_callback(), and depend upon this
value instead of ->se_cmd_flags to determine when to return
or fall through into ->queue_status() code for CAW.
Cc: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions