提交 0c85a7e8 编写于 作者: A Aditya Pakki 提交者: David S. Miller

net/rds: Avoid potential use after free in rds_send_remove_from_sock

In case of rs failure in rds_send_remove_from_sock(), the 'rm' resource
is freed and later under spinlock, causing potential use-after-free.
Set the free pointer to NULL to avoid undefined behavior.
Signed-off-by: NAditya Pakki <pakki001@umn.edu>
Acked-by: NSantosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5219d601
...@@ -180,6 +180,7 @@ void rds_message_put(struct rds_message *rm) ...@@ -180,6 +180,7 @@ void rds_message_put(struct rds_message *rm)
rds_message_purge(rm); rds_message_purge(rm);
kfree(rm); kfree(rm);
rm = NULL;
} }
} }
EXPORT_SYMBOL_GPL(rds_message_put); EXPORT_SYMBOL_GPL(rds_message_put);
......
...@@ -665,7 +665,7 @@ static void rds_send_remove_from_sock(struct list_head *messages, int status) ...@@ -665,7 +665,7 @@ static void rds_send_remove_from_sock(struct list_head *messages, int status)
unlock_and_drop: unlock_and_drop:
spin_unlock_irqrestore(&rm->m_rs_lock, flags); spin_unlock_irqrestore(&rm->m_rs_lock, flags);
rds_message_put(rm); rds_message_put(rm);
if (was_on_sock) if (was_on_sock && rm)
rds_message_put(rm); rds_message_put(rm);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部