Fix for memory overwrite-after-free bug in scst_local

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@575 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2008-11-19 10:55:58 +00:00
parent 31c2ada297
commit 7edb4c0c72

View File

@@ -1436,7 +1436,12 @@ void scst_free_cmd(struct scst_cmd *cmd)
#endif
#endif
scst_check_restore_sg_buff(cmd);
/*
* Target driver can already free sg buffer before calling
* scst_tgt_cmd_done(). E.g., scst_local has to do that.
*/
if (!cmd->tgt_data_buf_alloced)
scst_check_restore_sg_buff(cmd);
if (unlikely(cmd->internal)) {
if (cmd->bufflen > 0)