Skip to content

Commit 32faca6

Browse files
committed
Merge tag 'staging-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver fixes from Greg KH: "Here are some small staging driver fixes for 5.1-rc3, and one driver removal. The biggest thing here is the removal of the mt7621-eth driver as a "real" network driver was merged in 5.1-rc1 for this hardware, so this old driver can now be removed. Other than that, there are just a number of small fixes, all resolving reported issues and some potential corner cases for error handling paths. All of these have been in linux-next with no reported issues" * tag 'staging-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: vt6655: Remove vif check from vnt_interrupt staging: erofs: keep corrupted fs from crashing kernel in erofs_readdir() staging: octeon-ethernet: fix incorrect PHY mode staging: vc04_services: Fix an error code in vchiq_probe() staging: erofs: fix error handling when failed to read compresssed data staging: vt6655: Fix interrupt race condition on device start up. staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc staging: rtl8712: uninitialized memory in read_bbreg_hdl() staging: rtlwifi: rtl8822b: fix to avoid potential NULL pointer dereference staging: rtl8188eu: Fix potential NULL pointer dereference of kcalloc staging, mt7621-pci: fix build without pci support staging: speakup_soft: Fix alternate speech with other synths staging: axis-fifo: add CONFIG_OF dependency staging: olpc_dcon_xo_1: add missing 'const' qualifier staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest staging: erofs: fix to handle error path of erofs_vmap() staging: mt7621-dts: update ethernet settings. staging: remove mt7621-eth
2 parents 52afe19 + cc26358 commit 32faca6

File tree

43 files changed

+276
-4587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+276
-4587
lines changed

drivers/staging/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ source "drivers/staging/ralink-gdma/Kconfig"
114114

115115
source "drivers/staging/mt7621-mmc/Kconfig"
116116

117-
source "drivers/staging/mt7621-eth/Kconfig"
118-
119117
source "drivers/staging/mt7621-dts/Kconfig"
120118

121119
source "drivers/staging/gasket/Kconfig"

drivers/staging/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ obj-$(CONFIG_SPI_MT7621) += mt7621-spi/
4747
obj-$(CONFIG_SOC_MT7621) += mt7621-dma/
4848
obj-$(CONFIG_DMA_RALINK) += ralink-gdma/
4949
obj-$(CONFIG_MTK_MMC) += mt7621-mmc/
50-
obj-$(CONFIG_NET_MEDIATEK_SOC_STAGING) += mt7621-eth/
5150
obj-$(CONFIG_SOC_MT7621) += mt7621-dts/
5251
obj-$(CONFIG_STAGING_GASKET_FRAMEWORK) += gasket/
5352
obj-$(CONFIG_XIL_AXIS_FIFO) += axis-fifo/

drivers/staging/axis-fifo/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44
config XIL_AXIS_FIFO
55
tristate "Xilinx AXI-Stream FIFO IP core driver"
6+
depends on OF
67
default n
78
help
89
This adds support for the Xilinx AXI-Stream

drivers/staging/comedi/comedidev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,8 @@ int comedi_dio_insn_config(struct comedi_device *dev,
10011001
unsigned int mask);
10021002
unsigned int comedi_dio_update_state(struct comedi_subdevice *s,
10031003
unsigned int *data);
1004+
unsigned int comedi_bytes_per_scan_cmd(struct comedi_subdevice *s,
1005+
struct comedi_cmd *cmd);
10041006
unsigned int comedi_bytes_per_scan(struct comedi_subdevice *s);
10051007
unsigned int comedi_nscans_left(struct comedi_subdevice *s,
10061008
unsigned int nscans);

drivers/staging/comedi/drivers.c

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,13 @@ unsigned int comedi_dio_update_state(struct comedi_subdevice *s,
394394
EXPORT_SYMBOL_GPL(comedi_dio_update_state);
395395

396396
/**
397-
* comedi_bytes_per_scan() - Get length of asynchronous command "scan" in bytes
397+
* comedi_bytes_per_scan_cmd() - Get length of asynchronous command "scan" in
398+
* bytes
398399
* @s: COMEDI subdevice.
400+
* @cmd: COMEDI command.
399401
*
400402
* Determines the overall scan length according to the subdevice type and the
401-
* number of channels in the scan.
403+
* number of channels in the scan for the specified command.
402404
*
403405
* For digital input, output or input/output subdevices, samples for
404406
* multiple channels are assumed to be packed into one or more unsigned
@@ -408,9 +410,9 @@ EXPORT_SYMBOL_GPL(comedi_dio_update_state);
408410
*
409411
* Returns the overall scan length in bytes.
410412
*/
411-
unsigned int comedi_bytes_per_scan(struct comedi_subdevice *s)
413+
unsigned int comedi_bytes_per_scan_cmd(struct comedi_subdevice *s,
414+
struct comedi_cmd *cmd)
412415
{
413-
struct comedi_cmd *cmd = &s->async->cmd;
414416
unsigned int num_samples;
415417
unsigned int bits_per_sample;
416418

@@ -427,6 +429,29 @@ unsigned int comedi_bytes_per_scan(struct comedi_subdevice *s)
427429
}
428430
return comedi_samples_to_bytes(s, num_samples);
429431
}
432+
EXPORT_SYMBOL_GPL(comedi_bytes_per_scan_cmd);
433+
434+
/**
435+
* comedi_bytes_per_scan() - Get length of asynchronous command "scan" in bytes
436+
* @s: COMEDI subdevice.
437+
*
438+
* Determines the overall scan length according to the subdevice type and the
439+
* number of channels in the scan for the current command.
440+
*
441+
* For digital input, output or input/output subdevices, samples for
442+
* multiple channels are assumed to be packed into one or more unsigned
443+
* short or unsigned int values according to the subdevice's %SDF_LSAMPL
444+
* flag. For other types of subdevice, samples are assumed to occupy a
445+
* whole unsigned short or unsigned int according to the %SDF_LSAMPL flag.
446+
*
447+
* Returns the overall scan length in bytes.
448+
*/
449+
unsigned int comedi_bytes_per_scan(struct comedi_subdevice *s)
450+
{
451+
struct comedi_cmd *cmd = &s->async->cmd;
452+
453+
return comedi_bytes_per_scan_cmd(s, cmd);
454+
}
430455
EXPORT_SYMBOL_GPL(comedi_bytes_per_scan);
431456

432457
static unsigned int __comedi_nscans_left(struct comedi_subdevice *s,

drivers/staging/comedi/drivers/ni_mio_common.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3545,6 +3545,7 @@ static int ni_cdio_cmdtest(struct comedi_device *dev,
35453545
struct comedi_subdevice *s, struct comedi_cmd *cmd)
35463546
{
35473547
struct ni_private *devpriv = dev->private;
3548+
unsigned int bytes_per_scan;
35483549
int err = 0;
35493550

35503551
/* Step 1 : check if triggers are trivially valid */
@@ -3579,9 +3580,12 @@ static int ni_cdio_cmdtest(struct comedi_device *dev,
35793580
err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0);
35803581
err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg,
35813582
cmd->chanlist_len);
3582-
err |= comedi_check_trigger_arg_max(&cmd->stop_arg,
3583-
s->async->prealloc_bufsz /
3584-
comedi_bytes_per_scan(s));
3583+
bytes_per_scan = comedi_bytes_per_scan_cmd(s, cmd);
3584+
if (bytes_per_scan) {
3585+
err |= comedi_check_trigger_arg_max(&cmd->stop_arg,
3586+
s->async->prealloc_bufsz /
3587+
bytes_per_scan);
3588+
}
35853589

35863590
if (err)
35873591
return 3;

drivers/staging/erofs/dir.c

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ static const unsigned char erofs_filetype_table[EROFS_FT_MAX] = {
2323
[EROFS_FT_SYMLINK] = DT_LNK,
2424
};
2525

26+
static void debug_one_dentry(unsigned char d_type, const char *de_name,
27+
unsigned int de_namelen)
28+
{
29+
#ifdef CONFIG_EROFS_FS_DEBUG
30+
/* since the on-disk name could not have the trailing '\0' */
31+
unsigned char dbg_namebuf[EROFS_NAME_LEN + 1];
32+
33+
memcpy(dbg_namebuf, de_name, de_namelen);
34+
dbg_namebuf[de_namelen] = '\0';
35+
36+
debugln("found dirent %s de_len %u d_type %d", dbg_namebuf,
37+
de_namelen, d_type);
38+
#endif
39+
}
40+
2641
static int erofs_fill_dentries(struct dir_context *ctx,
2742
void *dentry_blk, unsigned int *ofs,
2843
unsigned int nameoff, unsigned int maxsize)
@@ -33,41 +48,31 @@ static int erofs_fill_dentries(struct dir_context *ctx,
3348
de = dentry_blk + *ofs;
3449
while (de < end) {
3550
const char *de_name;
36-
int de_namelen;
51+
unsigned int de_namelen;
3752
unsigned char d_type;
38-
#ifdef CONFIG_EROFS_FS_DEBUG
39-
unsigned int dbg_namelen;
40-
unsigned char dbg_namebuf[EROFS_NAME_LEN];
41-
#endif
4253

43-
if (unlikely(de->file_type < EROFS_FT_MAX))
54+
if (de->file_type < EROFS_FT_MAX)
4455
d_type = erofs_filetype_table[de->file_type];
4556
else
4657
d_type = DT_UNKNOWN;
4758

4859
nameoff = le16_to_cpu(de->nameoff);
4960
de_name = (char *)dentry_blk + nameoff;
5061

51-
de_namelen = unlikely(de + 1 >= end) ?
52-
/* last directory entry */
53-
strnlen(de_name, maxsize - nameoff) :
54-
le16_to_cpu(de[1].nameoff) - nameoff;
62+
/* the last dirent in the block? */
63+
if (de + 1 >= end)
64+
de_namelen = strnlen(de_name, maxsize - nameoff);
65+
else
66+
de_namelen = le16_to_cpu(de[1].nameoff) - nameoff;
5567

5668
/* a corrupted entry is found */
57-
if (unlikely(de_namelen < 0)) {
69+
if (unlikely(nameoff + de_namelen > maxsize ||
70+
de_namelen > EROFS_NAME_LEN)) {
5871
DBG_BUGON(1);
5972
return -EIO;
6073
}
6174

62-
#ifdef CONFIG_EROFS_FS_DEBUG
63-
dbg_namelen = min(EROFS_NAME_LEN - 1, de_namelen);
64-
memcpy(dbg_namebuf, de_name, dbg_namelen);
65-
dbg_namebuf[dbg_namelen] = '\0';
66-
67-
debugln("%s, found de_name %s de_len %d d_type %d", __func__,
68-
dbg_namebuf, de_namelen, d_type);
69-
#endif
70-
75+
debug_one_dentry(d_type, de_name, de_namelen);
7176
if (!dir_emit(ctx, de_name, de_namelen,
7277
le64_to_cpu(de->nid), d_type))
7378
/* stopped by some reason */

drivers/staging/erofs/unzip_vle.c

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ static int z_erofs_vle_unzip(struct super_block *sb,
972972
overlapped = false;
973973
compressed_pages = grp->compressed_pages;
974974

975+
err = 0;
975976
for (i = 0; i < clusterpages; ++i) {
976977
unsigned int pagenr;
977978

@@ -981,26 +982,39 @@ static int z_erofs_vle_unzip(struct super_block *sb,
981982
DBG_BUGON(!page);
982983
DBG_BUGON(!page->mapping);
983984

984-
if (z_erofs_is_stagingpage(page))
985-
continue;
985+
if (!z_erofs_is_stagingpage(page)) {
986986
#ifdef EROFS_FS_HAS_MANAGED_CACHE
987-
if (page->mapping == MNGD_MAPPING(sbi)) {
988-
DBG_BUGON(!PageUptodate(page));
989-
continue;
990-
}
987+
if (page->mapping == MNGD_MAPPING(sbi)) {
988+
if (unlikely(!PageUptodate(page)))
989+
err = -EIO;
990+
continue;
991+
}
991992
#endif
992993

993-
/* only non-head page could be reused as a compressed page */
994-
pagenr = z_erofs_onlinepage_index(page);
994+
/*
995+
* only if non-head page can be selected
996+
* for inplace decompression
997+
*/
998+
pagenr = z_erofs_onlinepage_index(page);
995999

996-
DBG_BUGON(pagenr >= nr_pages);
997-
DBG_BUGON(pages[pagenr]);
998-
++sparsemem_pages;
999-
pages[pagenr] = page;
1000+
DBG_BUGON(pagenr >= nr_pages);
1001+
DBG_BUGON(pages[pagenr]);
1002+
++sparsemem_pages;
1003+
pages[pagenr] = page;
10001004

1001-
overlapped = true;
1005+
overlapped = true;
1006+
}
1007+
1008+
/* PG_error needs checking for inplaced and staging pages */
1009+
if (unlikely(PageError(page))) {
1010+
DBG_BUGON(PageUptodate(page));
1011+
err = -EIO;
1012+
}
10021013
}
10031014

1015+
if (unlikely(err))
1016+
goto out;
1017+
10041018
llen = (nr_pages << PAGE_SHIFT) - work->pageofs;
10051019

10061020
if (z_erofs_vle_workgrp_fmt(grp) == Z_EROFS_VLE_WORKGRP_FMT_PLAIN) {
@@ -1029,6 +1043,10 @@ static int z_erofs_vle_unzip(struct super_block *sb,
10291043

10301044
skip_allocpage:
10311045
vout = erofs_vmap(pages, nr_pages);
1046+
if (!vout) {
1047+
err = -ENOMEM;
1048+
goto out;
1049+
}
10321050

10331051
err = z_erofs_vle_unzip_vmap(compressed_pages,
10341052
clusterpages, vout, llen, work->pageofs, overlapped);
@@ -1194,6 +1212,7 @@ pickup_page_for_submission(struct z_erofs_vle_workgroup *grp,
11941212
if (page->mapping == mc) {
11951213
WRITE_ONCE(grp->compressed_pages[nr], page);
11961214

1215+
ClearPageError(page);
11971216
if (!PagePrivate(page)) {
11981217
/*
11991218
* impossible to be !PagePrivate(page) for

drivers/staging/erofs/unzip_vle_lz4.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,13 @@ int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages,
136136

137137
nr_pages = DIV_ROUND_UP(outlen + pageofs, PAGE_SIZE);
138138

139-
if (clusterpages == 1)
139+
if (clusterpages == 1) {
140140
vin = kmap_atomic(compressed_pages[0]);
141-
else
141+
} else {
142142
vin = erofs_vmap(compressed_pages, clusterpages);
143+
if (!vin)
144+
return -ENOMEM;
145+
}
143146

144147
preempt_disable();
145148
vout = erofs_pcpubuf[smp_processor_id()].data;

drivers/staging/mt7621-dts/gbpc1.dts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,6 @@
117117
status = "okay";
118118
};
119119

120-
&ethernet {
121-
//mtd-mac-address = <&factory 0xe000>;
122-
gmac1: mac@0 {
123-
compatible = "mediatek,eth-mac";
124-
reg = <0>;
125-
phy-handle = <&phy1>;
126-
};
127-
128-
mdio-bus {
129-
phy1: ethernet-phy@1 {
130-
reg = <1>;
131-
phy-mode = "rgmii";
132-
};
133-
};
134-
};
135-
136120
&pinctrl {
137121
state_default: pinctrl0 {
138122
gpio {
@@ -141,3 +125,16 @@
141125
};
142126
};
143127
};
128+
129+
&switch0 {
130+
ports {
131+
port@0 {
132+
label = "ethblack";
133+
status = "ok";
134+
};
135+
port@4 {
136+
label = "ethblue";
137+
status = "ok";
138+
};
139+
};
140+
};

0 commit comments

Comments
 (0)