mirror of
https://github.com/versity/scoutfs.git
synced 2026-04-21 22:10:30 +00:00
Verify that log tree commit is for sending rid
We were trusting the rid in the log trees struct that the client sent. Compare it to our recorded rid on the connection and fail if the client sent the wrong rid. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -882,6 +882,7 @@ static int server_commit_log_trees(struct super_block *sb,
|
||||
u8 cmd, u64 id, void *arg, u16 arg_len)
|
||||
{
|
||||
struct scoutfs_super_block *super = &SCOUTFS_SB(sb)->super;
|
||||
const u64 rid = scoutfs_net_client_rid(conn);
|
||||
DECLARE_SERVER_INFO(sb, server);
|
||||
SCOUTFS_BTREE_ITEM_REF(iref);
|
||||
struct scoutfs_log_trees lt;
|
||||
@@ -896,6 +897,11 @@ static int server_commit_log_trees(struct super_block *sb,
|
||||
/* don't modify the caller's log_trees */
|
||||
memcpy(<, arg, sizeof(struct scoutfs_log_trees));
|
||||
|
||||
if (le64_to_cpu(lt.rid) != rid) {
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
scoutfs_server_hold_commit(sb);
|
||||
|
||||
mutex_lock(&server->logs_mutex);
|
||||
|
||||
Reference in New Issue
Block a user