Skip to content

Commit b04ae0f

Browse files
committed
Merge tag 'v6.12-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client fixes from Steve French: - Fix possible double free setting xattrs - Fix slab out of bounds with large ioctl payload - Remove three unused functions, and an unused variable that could be confusing * tag 'v6.12-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: Remove unused functions smb/client: Fix logically dead code smb: client: fix OOBs when building SMB2_IOCTL request smb: client: fix possible double free in smb2_set_ea()
2 parents 568570f + 6aca91c commit b04ae0f

File tree

6 files changed

+11
-58
lines changed

6 files changed

+11
-58
lines changed

fs/smb/client/cifsproto.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,6 @@ extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
252252
unsigned int to_read);
253253
extern ssize_t cifs_discard_from_socket(struct TCP_Server_Info *server,
254254
size_t to_read);
255-
extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
256-
struct page *page,
257-
unsigned int page_offset,
258-
unsigned int to_read);
259255
int cifs_read_iter_from_socket(struct TCP_Server_Info *server,
260256
struct iov_iter *iter,
261257
unsigned int to_read);
@@ -623,8 +619,6 @@ enum securityEnum cifs_select_sectype(struct TCP_Server_Info *,
623619
int cifs_alloc_hash(const char *name, struct shash_desc **sdesc);
624620
void cifs_free_hash(struct shash_desc **sdesc);
625621

626-
struct cifs_chan *
627-
cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server);
628622
int cifs_try_adding_channels(struct cifs_ses *ses);
629623
bool is_server_using_iface(struct TCP_Server_Info *server,
630624
struct cifs_server_iface *iface);
@@ -640,9 +634,6 @@ cifs_chan_set_in_reconnect(struct cifs_ses *ses,
640634
void
641635
cifs_chan_clear_in_reconnect(struct cifs_ses *ses,
642636
struct TCP_Server_Info *server);
643-
bool
644-
cifs_chan_in_reconnect(struct cifs_ses *ses,
645-
struct TCP_Server_Info *server);
646637
void
647638
cifs_chan_set_need_reconnect(struct cifs_ses *ses,
648639
struct TCP_Server_Info *server);

fs/smb/client/compress.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ static int collect_sample(const struct iov_iter *iter, ssize_t max, u8 *sample)
166166
loff_t start = iter->xarray_start + iter->iov_offset;
167167
pgoff_t last, index = start / PAGE_SIZE;
168168
size_t len, off, foff;
169-
ssize_t ret = 0;
170169
void *p;
171170
int s = 0;
172171

@@ -193,9 +192,6 @@ static int collect_sample(const struct iov_iter *iter, ssize_t max, u8 *sample)
193192
memcpy(&sample[s], p, len2);
194193
kunmap_local(p);
195194

196-
if (ret < 0)
197-
return ret;
198-
199195
s += len2;
200196

201197
if (len2 < SZ_2K || s >= max - SZ_2K)

fs/smb/client/connect.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -794,18 +794,6 @@ cifs_discard_from_socket(struct TCP_Server_Info *server, size_t to_read)
794794
return cifs_readv_from_socket(server, &smb_msg);
795795
}
796796

797-
int
798-
cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page,
799-
unsigned int page_offset, unsigned int to_read)
800-
{
801-
struct msghdr smb_msg = {};
802-
struct bio_vec bv;
803-
804-
bvec_set_page(&bv, page, to_read, page_offset);
805-
iov_iter_bvec(&smb_msg.msg_iter, ITER_DEST, &bv, 1, to_read);
806-
return cifs_readv_from_socket(server, &smb_msg);
807-
}
808-
809797
int
810798
cifs_read_iter_from_socket(struct TCP_Server_Info *server, struct iov_iter *iter,
811799
unsigned int to_read)

fs/smb/client/sess.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,6 @@ cifs_chan_clear_in_reconnect(struct cifs_ses *ses,
115115
ses->chans[chan_index].in_reconnect = false;
116116
}
117117

118-
bool
119-
cifs_chan_in_reconnect(struct cifs_ses *ses,
120-
struct TCP_Server_Info *server)
121-
{
122-
unsigned int chan_index = cifs_ses_get_chan_index(ses, server);
123-
124-
if (chan_index == CIFS_INVAL_CHAN_INDEX)
125-
return true; /* err on the safer side */
126-
127-
return CIFS_CHAN_IN_RECONNECT(ses, chan_index);
128-
}
129-
130118
void
131119
cifs_chan_set_need_reconnect(struct cifs_ses *ses,
132120
struct TCP_Server_Info *server)
@@ -487,26 +475,6 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
487475
spin_unlock(&ses->chan_lock);
488476
}
489477

490-
/*
491-
* If server is a channel of ses, return the corresponding enclosing
492-
* cifs_chan otherwise return NULL.
493-
*/
494-
struct cifs_chan *
495-
cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server)
496-
{
497-
int i;
498-
499-
spin_lock(&ses->chan_lock);
500-
for (i = 0; i < ses->chan_count; i++) {
501-
if (ses->chans[i].server == server) {
502-
spin_unlock(&ses->chan_lock);
503-
return &ses->chans[i];
504-
}
505-
}
506-
spin_unlock(&ses->chan_lock);
507-
return NULL;
508-
}
509-
510478
static int
511479
cifs_ses_add_channel(struct cifs_ses *ses,
512480
struct cifs_server_iface *iface)

fs/smb/client/smb2ops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
11581158
struct cifs_fid fid;
11591159
unsigned int size[1];
11601160
void *data[1];
1161-
struct smb2_file_full_ea_info *ea = NULL;
1161+
struct smb2_file_full_ea_info *ea;
11621162
struct smb2_query_info_rsp *rsp;
11631163
int rc, used_len = 0;
11641164
int retries = 0, cur_sleep = 1;
@@ -1179,6 +1179,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
11791179
if (!utf16_path)
11801180
return -ENOMEM;
11811181

1182+
ea = NULL;
11821183
resp_buftype[0] = resp_buftype[1] = resp_buftype[2] = CIFS_NO_BUFFER;
11831184
vars = kzalloc(sizeof(*vars), GFP_KERNEL);
11841185
if (!vars) {

fs/smb/client/smb2pdu.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3313,6 +3313,15 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
33133313
return rc;
33143314

33153315
if (indatalen) {
3316+
unsigned int len;
3317+
3318+
if (WARN_ON_ONCE(smb3_encryption_required(tcon) &&
3319+
(check_add_overflow(total_len - 1,
3320+
ALIGN(indatalen, 8), &len) ||
3321+
len > MAX_CIFS_SMALL_BUFFER_SIZE))) {
3322+
cifs_small_buf_release(req);
3323+
return -EIO;
3324+
}
33163325
/*
33173326
* indatalen is usually small at a couple of bytes max, so
33183327
* just allocate through generic pool

0 commit comments

Comments
 (0)