Skip to content

Commit 51a1387

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: remove the leftover of smb2.0 dialect support
Although ksmbd doesn't send SMB2.0 support in supported dialect list of smb negotiate response, There is the leftover of smb2.0 dialect. This patch remove it not to support SMB2.0 in ksmbd. Cc: Tom Talpey <[email protected]> Cc: Ronnie Sahlberg <[email protected]> Cc: Ralph Böhme <[email protected]> Cc: Hyunchul Lee <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent c2e99d4 commit 51a1387

File tree

4 files changed

+12
-34
lines changed

4 files changed

+12
-34
lines changed

fs/ksmbd/smb2ops.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,6 @@ static struct smb_version_cmds smb2_0_server_cmds[NUMBER_OF_SMB2_COMMANDS] = {
187187
[SMB2_CHANGE_NOTIFY_HE] = { .proc = smb2_notify},
188188
};
189189

190-
int init_smb2_0_server(struct ksmbd_conn *conn)
191-
{
192-
return -EOPNOTSUPP;
193-
}
194-
195190
/**
196191
* init_smb2_1_server() - initialize a smb server connection with smb2.1
197192
* command dispatcher

fs/ksmbd/smb2pdu.c

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,6 @@ int init_smb2_neg_rsp(struct ksmbd_work *work)
236236

237237
if (conn->need_neg == false)
238238
return -EINVAL;
239-
if (!(conn->dialect >= SMB20_PROT_ID &&
240-
conn->dialect <= SMB311_PROT_ID))
241-
return -EINVAL;
242239

243240
rsp_hdr = work->response_buf;
244241

@@ -1166,13 +1163,6 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
11661163
case SMB21_PROT_ID:
11671164
init_smb2_1_server(conn);
11681165
break;
1169-
case SMB20_PROT_ID:
1170-
rc = init_smb2_0_server(conn);
1171-
if (rc) {
1172-
rsp->hdr.Status = STATUS_NOT_SUPPORTED;
1173-
goto err_out;
1174-
}
1175-
break;
11761166
case SMB2X_PROT_ID:
11771167
case BAD_PROT_ID:
11781168
default:
@@ -1191,11 +1181,9 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
11911181
rsp->MaxReadSize = cpu_to_le32(conn->vals->max_read_size);
11921182
rsp->MaxWriteSize = cpu_to_le32(conn->vals->max_write_size);
11931183

1194-
if (conn->dialect > SMB20_PROT_ID) {
1195-
memcpy(conn->ClientGUID, req->ClientGUID,
1196-
SMB2_CLIENT_GUID_SIZE);
1197-
conn->cli_sec_mode = le16_to_cpu(req->SecurityMode);
1198-
}
1184+
memcpy(conn->ClientGUID, req->ClientGUID,
1185+
SMB2_CLIENT_GUID_SIZE);
1186+
conn->cli_sec_mode = le16_to_cpu(req->SecurityMode);
11991187

12001188
rsp->StructureSize = cpu_to_le16(65);
12011189
rsp->DialectRevision = cpu_to_le16(conn->dialect);
@@ -1537,11 +1525,9 @@ static int ntlm_authenticate(struct ksmbd_work *work)
15371525
}
15381526
}
15391527

1540-
if (conn->dialect > SMB20_PROT_ID) {
1541-
if (!ksmbd_conn_lookup_dialect(conn)) {
1542-
pr_err("fail to verify the dialect\n");
1543-
return -ENOENT;
1544-
}
1528+
if (!ksmbd_conn_lookup_dialect(conn)) {
1529+
pr_err("fail to verify the dialect\n");
1530+
return -ENOENT;
15451531
}
15461532
return 0;
15471533
}
@@ -1623,11 +1609,9 @@ static int krb5_authenticate(struct ksmbd_work *work)
16231609
}
16241610
}
16251611

1626-
if (conn->dialect > SMB20_PROT_ID) {
1627-
if (!ksmbd_conn_lookup_dialect(conn)) {
1628-
pr_err("fail to verify the dialect\n");
1629-
return -ENOENT;
1630-
}
1612+
if (!ksmbd_conn_lookup_dialect(conn)) {
1613+
pr_err("fail to verify the dialect\n");
1614+
return -ENOENT;
16311615
}
16321616
return 0;
16331617
}

fs/ksmbd/smb2pdu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,6 @@ struct smb2_posix_info {
16371637
} __packed;
16381638

16391639
/* functions */
1640-
int init_smb2_0_server(struct ksmbd_conn *conn);
16411640
void init_smb2_1_server(struct ksmbd_conn *conn);
16421641
void init_smb3_0_server(struct ksmbd_conn *conn);
16431642
void init_smb3_02_server(struct ksmbd_conn *conn);

fs/ksmbd/smb_common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ unsigned int ksmbd_server_side_copy_max_total_size(void)
8888

8989
inline int ksmbd_min_protocol(void)
9090
{
91-
return SMB2_PROT;
91+
return SMB21_PROT;
9292
}
9393

9494
inline int ksmbd_max_protocol(void)
@@ -427,7 +427,7 @@ int ksmbd_extract_shortname(struct ksmbd_conn *conn, const char *longname,
427427

428428
static int __smb2_negotiate(struct ksmbd_conn *conn)
429429
{
430-
return (conn->dialect >= SMB20_PROT_ID &&
430+
return (conn->dialect >= SMB21_PROT_ID &&
431431
conn->dialect <= SMB311_PROT_ID);
432432
}
433433

@@ -457,7 +457,7 @@ int ksmbd_smb_negotiate_common(struct ksmbd_work *work, unsigned int command)
457457
}
458458
}
459459

460-
if (command == SMB2_NEGOTIATE_HE) {
460+
if (command == SMB2_NEGOTIATE_HE && __smb2_negotiate(conn)) {
461461
ret = smb2_handle_negotiate(work);
462462
init_smb2_neg_rsp(work);
463463
return ret;

0 commit comments

Comments
 (0)