Skip to content

Commit 658609d

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: avoid duplicate opinfo_put() call on error of smb21_lease_break_ack()
opinfo_put() could be called twice on error of smb21_lease_break_ack(). It will cause UAF issue if opinfo is referenced on other places. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent c2a721e commit 658609d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

fs/smb/server/smb2pdu.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8219,18 +8219,18 @@ static void smb21_lease_break_ack(struct ksmbd_work *work)
82198219
le32_to_cpu(req->LeaseState));
82208220
}
82218221

8222+
if (ret < 0) {
8223+
rsp->hdr.Status = err;
8224+
goto err_out;
8225+
}
8226+
82228227
lease_state = lease->state;
82238228
opinfo->op_state = OPLOCK_STATE_NONE;
82248229
wake_up_interruptible_all(&opinfo->oplock_q);
82258230
atomic_dec(&opinfo->breaking_cnt);
82268231
wake_up_interruptible_all(&opinfo->oplock_brk);
82278232
opinfo_put(opinfo);
82288233

8229-
if (ret < 0) {
8230-
rsp->hdr.Status = err;
8231-
goto err_out;
8232-
}
8233-
82348234
rsp->StructureSize = cpu_to_le16(36);
82358235
rsp->Reserved = 0;
82368236
rsp->Flags = 0;

0 commit comments

Comments
 (0)