4.4.236-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.4.236-rc1 review
This is the start of the stable review cycle for the 4.4.236 release. There are 62 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 13 Sep 2020 12:24:42 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.236-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.4.236-rc1
Jakub Kicinski <[email protected]>
net: disable netpoll on fresh napis
Xin Long <[email protected]>
sctp: not disable bh in the whole sctp_get_port_local()
Kamil Lorenc <[email protected]>
net: usb: dm9601: Add USB ID of Keenetic Plus DSL
Jakub Kicinski <[email protected]>
bnxt: don't enable NAPI until rings are ready
Michael Chan <[email protected]>
bnxt_en: Failure to update PHY is not fatal condition.
Shung-Hsi Yu <[email protected]>
net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()
Yuusuke Ashizuka <[email protected]>
ravb: Fixed to be able to unload modules
Max Staudt <[email protected]>
affs: fix basic permission bits to actually work
Fabian Frederick <[email protected]>
fs/affs: use octal for permissions
Takashi Sakamoto <[email protected]>
ALSA; firewire-tascam: exclude Tascam FE-8 from detection
Takashi Sakamoto <[email protected]>
ALSA: firewire-digi00x: exclude Avid Adrenaline from detection
Takashi Sakamoto <[email protected]>
ALSA: firewire-digi00x: add support for console models of Digi00x series
Himadri Pandya <[email protected]>
net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
Johannes Berg <[email protected]>
cfg80211: regulatory: reject invalid hints
Muchun Song <[email protected]>
mm/hugetlb: fix a race between hugetlb sysctl handlers
Mrinal Pandey <[email protected]>
checkpatch: fix the usage of capture group ( ... )
Tim Froidcoeur <[email protected]>
net: initialize fastreuse on inet_inherit_port
Tim Froidcoeur <[email protected]>
net: refactor bind_bucket fastreuse into helper
Ye Bin <[email protected]>
dm thin metadata: Avoid returning cmd->bm wild pointer on error
Ye Bin <[email protected]>
dm cache metadata: Avoid returning cmd->bm wild pointer on error
Takashi Iwai <[email protected]>
ALSA: pcm: oss: Remove superfluous WARN_ON() for mulaw sanity check
Tong Zhang <[email protected]>
ALSA: ca0106: fix error code handling
Daniele Palmas <[email protected]>
net: usb: qmi_wwan: add Telit 0x1050 composition
Daniele Palmas <[email protected]>
net: usb: qmi_wwan: add Telit ME910 support
Rogan Dawes <[email protected]>
usb: qmi_wwan: add D-Link DWM-222 A2 device ID
Daniele Palmas <[email protected]>
drivers: net: usb: qmi_wwan: add QMI_QUIRK_SET_DTR for Telit PID 0x1201
Daniele Palmas <[email protected]>
NET: usb: qmi_wwan: add support for Telit LE922A PID 0x1040
Bjørn Mork <[email protected]>
qmi_wwan: add support for Quectel EC21 and EC25
Schemmel Hans-Christoph <[email protected]>
qmi_wwan: Added support for Gemalto's Cinterion PHxx WWAN interface
Patrik Halfar <[email protected]>
Add Dell Wireless 5809e Gobi 4G HSPA+ Mobile Broadband Card (rev3) to qmi_wwan
Bjørn Mork <[email protected]>
net: qmi_wwan: ignore bogus CDC Union descriptors
Bjørn Mork <[email protected]>
net: qmi_wwan: should hold RTNL while changing netdev type
Bjørn Mork <[email protected]>
net: qmi_wwan: support "raw IP" mode
Bjørn Mork <[email protected]>
net: qmi_wwan: MDM9x30 specific power management
Josef Bacik <[email protected]>
btrfs: fix potential deadlock in the search ioctl
Daniel Borkmann <[email protected]>
uaccess: Add non-pagefault user-space write function
Masami Hiramatsu <[email protected]>
uaccess: Add non-pagefault user-space read functions
Josef Bacik <[email protected]>
btrfs: set the lockdep class for log tree extent buffers
Nikolay Borisov <[email protected]>
btrfs: Remove extraneous extent_buffer_get from tree_mod_log_rewind
Nikolay Borisov <[email protected]>
btrfs: Remove redundant extent_buffer_get in get_old_root
Josef Bacik <[email protected]>
btrfs: drop path before adding new uuid tree entry
Jason Gunthorpe <[email protected]>
include/linux/log2.h: add missing () around n in roundup_pow_of_two()
Tony Lindgren <[email protected]>
thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430
Lu Baolu <[email protected]>
iommu/vt-d: Serialize IOMMU GCMD register modifications
Michael Chan <[email protected]>
tg3: Fix soft lockup when tg3_reset_task() fails.
Al Viro <[email protected]>
fix regression in "epoll: Keep a reference on files added to the check list"
Vasundhara Volam <[email protected]>
bnxt_en: Check for zero dir entries in NVRAM.
Marek Szyprowski <[email protected]>
dmaengine: pl330: Fix burst length if burst size is smaller than bus width
Florian Westphal <[email protected]>
netfilter: nf_tables: fix destination register zeroing
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: incorrect enum nft_list_attributes definition
Yu Kuai <[email protected]>
dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
Jussi Kivilinna <[email protected]>
batman-adv: bla: use netif_rx_ni when not in interrupt context
Sven Eckelmann <[email protected]>
batman-adv: Avoid uninitialized chaddr when handling DHCP
Peter Ujfalusi <[email protected]>
dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling
Simon Leiner <[email protected]>
xen/xenbus: Fix granting of vmalloc'd memory
Sven Schnelle <[email protected]>
s390: don't trace preemption in percpu macros
Jeff Layton <[email protected]>
ceph: don't allow setlease on cephfs
Tom Rix <[email protected]>
hwmon: (applesmc) check status earlier.
Mel Gorman <[email protected]>
mm, page_alloc: remove unnecessary variable from free_pcppages_bulk
Kim Phillips <[email protected]>
perf record/stat: Explicitly call out event modifiers in the documentation
Marc Zyngier <[email protected]>
HID: core: Sanitize event code and type when mapping input
Marc Zyngier <[email protected]>
HID: core: Correctly handle ReportSize being zero
-------------
Diffstat:
Documentation/filesystems/affs.txt | 16 +- Makefile | 4 +- arch/s390/include/asm/percpu.h | 28 ++-- drivers/dma/at_hdmac.c | 2 + drivers/dma/of-dma.c | 8 +- drivers/dma/pl330.c | 2 +- drivers/hid/hid-core.c | 15 +- drivers/hid/hid-input.c | 4 + drivers/hid/hid-multitouch.c | 2 + drivers/hwmon/applesmc.c | 31 ++-- drivers/iommu/intel_irq_remapping.c | 10 +- drivers/md/dm-cache-metadata.c | 8 +- drivers/md/dm-thin-metadata.c | 8 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 11 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 + drivers/net/ethernet/broadcom/tg3.c | 17 +- drivers/net/ethernet/mellanox/mlx4/mr.c | 2 +- drivers/net/ethernet/renesas/ravb_main.c | 110 ++++++------ drivers/net/usb/asix_common.c | 2 +- drivers/net/usb/dm9601.c | 4 + drivers/net/usb/qmi_wwan.c | 185 ++++++++++++++++++++- .../thermal/ti-soc-thermal/omap4-thermal-data.c | 23 +-- drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h | 10 +- drivers/xen/xenbus/xenbus_client.c | 10 +- fs/affs/amigaffs.c | 63 +++++-- fs/affs/file.c | 26 ++- fs/btrfs/ctree.c | 8 +- fs/btrfs/extent_io.c | 8 +- fs/btrfs/extent_io.h | 6 +- fs/btrfs/ioctl.c | 27 ++- fs/btrfs/volumes.c | 3 +- fs/ceph/file.c | 1 + fs/eventpoll.c | 6 +- include/linux/hid.h | 42 +++-- include/linux/log2.h | 2 +- include/linux/uaccess.h | 26 +++ include/net/inet_connection_sock.h | 4 + include/net/netfilter/nf_tables.h | 2 + include/uapi/linux/netfilter/nf_tables.h | 2 +- mm/hugetlb.c | 26 ++- mm/maccess.c | 167 +++++++++++++++++-- mm/page_alloc.c | 7 +- net/batman-adv/bridge_loop_avoidance.c | 5 +- net/batman-adv/gateway_client.c | 6 +- net/core/dev.c | 3 +- net/core/netpoll.c | 2 +- net/ipv4/inet_connection_sock.c | 46 +++-- net/ipv4/inet_hashtables.c | 1 + net/netfilter/nft_payload.c | 4 +- net/sctp/socket.c | 16 +- net/wireless/reg.c | 3 + scripts/checkpatch.pl | 4 +- sound/core/oss/mulaw.c | 4 +- sound/firewire/digi00x/digi00x.c | 18 +- sound/firewire/digi00x/digi00x.h | 1 + sound/firewire/tascam/tascam.c | 30 +++- sound/pci/ca0106/ca0106_main.c | 3 +- tools/perf/Documentation/perf-record.txt | 4 + tools/perf/Documentation/perf-stat.txt | 4 + 59 files changed, 841 insertions(+), 254 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/62 HID: core: Correctly handle ReportSize being zero
From: Marc Zyngier <[email protected]>
commit bce1305c0ece3dc549663605e567655dd701752c upstream.
It appears that a ReportSize value of zero is legal, even if a bit non-sensical. Most of the HID code seems to handle that gracefully, except when computing the total size in bytes. When fed as input to memset, this leads to some funky outcomes.
Detect the corner case and correctly compute the size.
--- drivers/hid/hid-core.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/hid/hid-core.c +13 -2
@@ -1368,6 +1368,17 @@ static void hid_output_field(const struc }/* +* Compute the size of a report. +*/ +static size_t hid_compute_report_size (struct hid_report *report) +{ +if (report->size) +return ((report->size -1 ) >>3 ) +1 ; + +return 0 ; +} + +/* * Create a report. 'data' has to be allocated using * hid_alloc_report_buf() so that it has proper size. */
@@ -1379,7 +1390,7 @@ void hid_output_report(struct hid_reportif (report->id >0 ) *data++ = report->id; -memset (data,0 , ((report->size -1 ) >>3 ) +1 ); +memset (data,0 ,hid_compute_report_size (report));for (n =0 ; n < report->maxfield; n++)hid_output_field (report->device, report->field[n], data); }
@@ -1506,7 +1517,7 @@ int hid_report_raw_event(struct hid_devi csize--; } - rsize = ((report->size -1 ) >>3 ) +1 ; + rsize =hid_compute_report_size (report);if (report_enum->numbered && rsize >=HID_MAX_BUFFER_SIZE ) rsize =HID_MAX_BUFFER_SIZE -1 ;
Greg Kroah-Hartman
maintainerPATCH 2/62 HID: core: Sanitize event code and type when mapping input
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 35556bed836f8dc07ac55f69c8d17dce3e7f0e25 upstream.
When calling into hid_map_usage(), the passed event code is blindly stored as is, even if it doesn't fit in the associated bitmap.
This event code can come from a variety of sources, including devices masquerading as input devices, only a bit more "programmable".
Instead of taking the event code at face value, check that it actually fits the corresponding bitmap, and if it doesn't:
- spit out a warning so that we know which device is acting up
- NULLify the bitmap pointer so that we catch unexpected uses
Code paths that can make use of untrusted inputs can now check that the mapping was indeed correct and bail out if not.
--- drivers/hid/hid-input.c | 4 ++++ drivers/hid/hid-multitouch.c | 2 ++ include/linux/hid.h | 42 +++++++++++++++++++++++++++++------------- 3 files changed, 35 insertions(+), 13 deletions(-)
drivers/hid/hid-input.c +4 -0
@@ -994,6 +994,10 @@ static void hidinput_configure_usage(str } mapped: +/* Mapping failed, bail out */ +if (!bit) +return ; +if (device->driver->input_mapped && device->driver->input_mapped (device, hidinput, field, usage, &bit, &max) <0 ) {
drivers/hid/hid-multitouch.c +2 -0
@@ -569,6 +569,8 @@ static int mt_touch_input_mapping(structcase HID_UP_BUTTON : code =BTN_MOUSE + ((usage->hid -1 ) &HID_USAGE );hid_map_usage (hi, usage, bit, max,EV_KEY , code); +if (!*bit) +return -1 ;input_set_capability (hi->input,EV_KEY , code);return 1 ;
include/linux/hid.h +29 -13
70 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 3/62 perf record/stat: Explicitly call out event modifiers in the documentation
In reply to Greg Kroah-HartmanFrom: Kim Phillips <[email protected]>
commit e48a73a312ebf19cc3d72aa74985db25c30757c1 upstream.
Event modifiers are not mentioned in the perf record or perf stat manpages. Add them to orient new users more effectively by pointing them to the perf list manpage for details.
--- tools/perf/Documentation/perf-record.txt | 4 ++++ tools/perf/Documentation/perf-stat.txt | 4 ++++ 2 files changed, 8 insertions(+)
tools/perf/Documentation/perf-record.txt +4 -0
@@ -33,6 +33,10 @@ OPTIONS - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a hexadecimal event descriptor. + - a symbolic or raw PMU event followed by an optional colon + and a list of event modifiers, e.g., cpu-cycles:p. See the + linkperf:perf-list[1] man page for details on event modifiers. + - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where 'param1', 'param2', etc are defined as formats for the PMU in /sys/bus/event_sources/devices/<pmu>/format/*.
tools/perf/Documentation/perf-stat.txt +4 -0
@@ -32,6 +32,10 @@ OPTIONS - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a hexadecimal event descriptor. + - a symbolic or raw PMU event followed by an optional colon + and a list of event modifiers, e.g., cpu-cycles:p. See the + linkperf:perf-list[1] man page for details on event modifiers. + - a symbolically formed event like 'pmu/param1=0x3,param2/' where param1 and param2 are defined as formats for the PMU in /sys/bus/event_sources/devices/<pmu>/format/*
Greg Kroah-Hartman
maintainerPATCH 4/62 mm, page_alloc: remove unnecessary variable from free_pcppages_bulk
In reply to Greg Kroah-HartmanFrom: Mel Gorman <[email protected]>
commit e5b31ac2ca2cd0cf6bf2fcbb708ed01466c89aaa upstream.
The original count is never reused so it can be removed.
--- mm/page_alloc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
mm/page_alloc.c +3 -4
@@ -835,7 +835,6 @@ static void free_pcppages_bulk(struct zo {int migratetype =0 ;int batch_free =0 ; -int to_free = count;unsigned long nr_scanned;spin_lock (&zone->lock);
@@ -848,7 +847,7 @@ static void free_pcppages_bulk(struct zo* below while (list_empty(list)) loop. */ count =min (pcp->count, count); -while (to_free) { +while (count) {struct page *page;struct list_head *list;
@@ -868,7 +867,7 @@ static void free_pcppages_bulk(struct zo/* This is the only non-empty list. Free them all. */ if (batch_free ==MIGRATE_PCPTYPES ) - batch_free = to_free; + batch_free = count; do { int mt; /* migratetype of the to-be-freed page */
@@ -886,7 +885,7 @@ static void free_pcppages_bulk(struct zo__free_one_page (page,page_to_pfn (page), zone,0 , mt);trace_mm_page_pcpu_drain (page,0 , mt); - }while (--to_free && --batch_free && !list_empty (list)); + }while (--count && --batch_free && !list_empty (list)); }spin_unlock (&zone->lock); }
Greg Kroah-Hartman
maintainerPATCH 5/62 hwmon: (applesmc) check status earlier.
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit cecf7560f00a8419396a2ed0f6e5d245ccb4feac ]
clang static analysis reports this representative problem
applesmc.c:758:10: warning: 1st function call argument is an
uninitialized value
left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~buffer is filled by the earlier call
ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, ...
This problem is reported because a goto skips the status check. Other similar problems use data from applesmc_read_key before checking the status. So move the checks to before the use.
--- drivers/hwmon/applesmc.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/hwmon/applesmc.c +16 -15
@@ -758,15 +758,18 @@ static ssize_t applesmc_light_show(struct device *dev, } ret =applesmc_read_key (LIGHT_SENSOR_LEFT_KEY , buffer, data_length); +if (ret) + goto out;/* newer macbooks report a single 10-bit bigendian value */ if (data_length ==10 ) { left =be16_to_cpu (*(__be16 *)(buffer +6 )) >>2 ; goto out; } left = buffer[2 ]; + + ret =applesmc_read_key (LIGHT_SENSOR_RIGHT_KEY , buffer, data_length);if (ret) goto out; - ret =applesmc_read_key (LIGHT_SENSOR_RIGHT_KEY , buffer, data_length); right = buffer[2 ]; out:
@@ -814,12 +817,11 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,sprintf (newkey, fan_speed_fmt[to_option (attr)],to_index (attr)); ret =applesmc_read_key (newkey, buffer,2 ); - speed = ((buffer[0 ] <<8 | buffer[1 ]) >>2 ); -if (ret)return ret; -else -return snprintf (sysfsbuf,PAGE_SIZE ,"%u\n" , speed); + + speed = ((buffer[0 ] <<8 | buffer[1 ]) >>2 ); +return snprintf (sysfsbuf,PAGE_SIZE ,"%u\n" , speed); } static ssize_t applesmc_store_fan_speed(struct device *dev,
@@ -854,12 +856,11 @@ static ssize_t applesmc_show_fan_manual(struct device *dev,u8 buffer[2 ]; ret =applesmc_read_key (FANS_MANUAL , buffer,2 ); - manual = ((buffer[0 ] <<8 | buffer[1 ]) >>to_index (attr)) &0x01 ; -if (ret)return ret; -else -return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , manual); + + manual = ((buffer[0 ] <<8 | buffer[1 ]) >>to_index (attr)) &0x01 ; +return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , manual); } static ssize_t applesmc_store_fan_manual(struct device *dev,
@@ -875,10 +876,11 @@ static ssize_t applesmc_store_fan_manual(struct device *dev,return -EINVAL ; ret =applesmc_read_key (FANS_MANUAL , buffer,2 ); - val = (buffer[0 ] <<8 | buffer[1 ]);if (ret) goto out; + val = (buffer[0 ] <<8 | buffer[1 ]); +if (input) val = val | (0x01 <<to_index (attr));else
@@ -954,13 +956,12 @@ static ssize_t applesmc_key_count_show(struct device *dev,u32 count; ret =applesmc_read_key (KEY_COUNT_KEY , buffer,4 ); - count = ((u32 )buffer[0 ]<<24 ) + ((u32 )buffer[1 ]<<16 ) + - ((u32 )buffer[2 ]<<8 ) + buffer[3 ]; -if (ret)return ret; -else -return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , count); + + count = ((u32 )buffer[0 ]<<24 ) + ((u32 )buffer[1 ]<<16 ) + + ((u32 )buffer[2 ]<<8 ) + buffer[3 ]; +return snprintf (sysfsbuf,PAGE_SIZE ,"%d\n" , count); } static ssize_t applesmc_key_at_index_read_show(struct device *dev,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 6/62 ceph: dont allow setlease on cephfs
In reply to Greg Kroah-HartmanFrom: Jeff Layton <[email protected]>
[ Upstream commit 496ceaf12432b3d136dcdec48424312e71359ea7 ]
Leases don't currently work correctly on kcephfs, as they are not broken when caps are revoked. They could eventually be implemented similarly to how we did them in libcephfs, but for now don't allow them.
[ idryomov: no need for simple_nosetlease() in ceph_dir_fops and
ceph_snapdir_fops ]
--- fs/ceph/file.c | 1 + 1 file changed, 1 insertion(+)
fs/ceph/file.c +1 -0
@@ -1433,6 +1433,7 @@ const struct file_operations ceph_file_fops = { .mmap = ceph_mmap, .fsync = ceph_fsync, .lock = ceph_lock, + .setlease = simple_nosetlease, .flock = ceph_flock, .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 7/62 s390: dont trace preemption in percpu macros
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 1196f12a2c960951d02262af25af0bb1775ebcc2 ]
Since commit a21ee6055c30 ("lockdep: Change hardirq{s_enabled,_context} to per-cpu variables") the lockdep code itself uses percpu variables. This leads to recursions because the percpu macros are calling preempt_enable() which might call trace_preempt_on().
--- arch/s390/include/asm/percpu.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
arch/s390/include/asm/percpu.h +14 -14
@@ -28,7 +28,7 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ old__, new__, prev__; \pcp_op_T__ *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ prev__ = *ptr__; \ do { \
@@ -36,7 +36,7 @@ new__ = old__ op (val); \ prev__ =cmpxchg (ptr__, old__, new__); \ }while (prev__ != old__); \ -preempt_enable (); \ +preempt_enable_notrace (); \ new__; \ })
@@ -67,7 +67,7 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ val__ = (val); \pcp_op_T__ old__, *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \if (__builtin_constant_p (val__) && \ ((szcast )val__ >-129 ) && ((szcast )val__ <128 )) { \
@@ -83,7 +83,7 @@ : [val__] "d" (val__) \ : "cc"); \ } \ -preempt_enable (); \ +preempt_enable_notrace (); \ }#define this_cpu_add_4 (pcp, val) arch_this_cpu_add(pcp, val, "laa", "asi", int)
@@ -94,14 +94,14 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ val__ = (val); \pcp_op_T__ old__, *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ asmvolatile ( \ op" %[old__],%[val__],%[ptr__]\n" \ : [old__]"=d" (old__), [ptr__]"+Q" (*ptr__) \ : [val__]"d" (val__) \ :"cc" ); \ -preempt_enable (); \ +preempt_enable_notrace (); \ old__ + val__; \ })
@@ -113,14 +113,14 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ val__ = (val); \pcp_op_T__ old__, *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ asmvolatile ( \ op" %[old__],%[val__],%[ptr__]\n" \ : [old__]"=d" (old__), [ptr__]"+Q" (*ptr__) \ : [val__]"d" (val__) \ :"cc" ); \ -preempt_enable (); \ +preempt_enable_notrace (); \ }#define this_cpu_and_4 (pcp, val) arch_this_cpu_to_op(pcp, val, "lan")
@@ -135,10 +135,10 @@typedef typeof (pcp)pcp_op_T__ ; \pcp_op_T__ ret__; \pcp_op_T__ *ptr__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ ret__ =cmpxchg (ptr__, oval, nval); \ -preempt_enable (); \ +preempt_enable_notrace (); \ ret__; \ })
@@ -151,10 +151,10 @@ ({ \typeof (pcp) *ptr__; \typeof (pcp) ret__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ ptr__ =raw_cpu_ptr (&(pcp)); \ ret__ =xchg (ptr__, nval); \ -preempt_enable (); \ +preempt_enable_notrace (); \ ret__; \ })
@@ -170,11 +170,11 @@typeof (pcp1) *p1__; \typeof (pcp2) *p2__; \int ret__; \ -preempt_disable (); \ +preempt_disable_notrace (); \ p1__ =raw_cpu_ptr (&(pcp1)); \ p2__ =raw_cpu_ptr (&(pcp2)); \ ret__ =__cmpxchg_double (p1__, p2__, o1__, o2__, n1__, n2__); \ -preempt_enable (); \ +preempt_enable_notrace (); \ ret__; \ })
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 8/62 xen/xenbus: Fix granting of vmallocd memory
In reply to Greg Kroah-HartmanFrom: Simon Leiner <[email protected]>
[ Upstream commit d742db70033c745e410523e00522ee0cfe2aa416 ]
On some architectures (like ARM), virt_to_gfn cannot be used for vmalloc'd memory because of its reliance on virt_to_phys. This patch introduces a check for vmalloc'd addresses and obtains the PFN using vmalloc_to_pfn in that case.
--- drivers/xen/xenbus/xenbus_client.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/xen/xenbus/xenbus_client.c +8 -2
@@ -384,8 +384,14 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,int i, j;for (i =0 ; i < nr_pages; i++) { - err =gnttab_grant_foreign_access (dev->otherend_id, -virt_to_gfn (vaddr),0 ); +unsigned long gfn; + +if (is_vmalloc_addr (vaddr)) + gfn =pfn_to_gfn (vmalloc_to_pfn (vaddr)); +else + gfn =virt_to_gfn (vaddr); + + err =gnttab_grant_foreign_access (dev->otherend_id, gfn,0 );if (err <0 ) {xenbus_dev_fatal (dev, err,"granting access to ring page" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 9/62 dmaengine: of-dma: Fix of_dma_router_xlates of_dma_xlate handling
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 5b2aa9f918f6837ae943557f8cec02c34fcf80e7 ]
of_dma_xlate callback can return ERR_PTR as well NULL in case of failure.
If error code is returned (not NULL) then the route should be released and the router should not be registered for the channel.
--- drivers/dma/of-dma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/dma/of-dma.c +4 -4
@@ -72,12 +72,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec,return NULL ; chan = ofdma_target->of_dma_xlate (&dma_spec_target, ofdma_target); -if (chan) { - chan->router = ofdma->dma_router; - chan->route_data = route_data; - }else { +if (IS_ERR_OR_NULL (chan)) { ofdma->dma_router->route_free (ofdma->dma_router->dev, route_data); + }else { + chan->router = ofdma->dma_router; + chan->route_data = route_data; }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 10/62 batman-adv: Avoid uninitialized chaddr when handling DHCP
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
[ Upstream commit 303216e76dcab6049c9d42390b1032f0649a8206 ]
The gateway client code can try to optimize the delivery of DHCP packets to avoid broadcasting them through the whole mesh. But also transmissions to the client can be optimized by looking up the destination via the chaddr of the DHCP packet.
But the chaddr is currently only done when chaddr is fully inside the non-paged area of the skbuff. Otherwise it will not be initialized and the unoptimized path should have been taken.
But the implementation didn't handle this correctly. It didn't retrieve the correct chaddr but still tried to perform the TT lookup with this uninitialized memory.
--- net/batman-adv/gateway_client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/batman-adv/gateway_client.c +4 -2
@@ -757,8 +757,10 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, chaddr_offset = *header_len +BATADV_DHCP_CHADDR_OFFSET ;/* store the client address if the message is going to a client */ -if (ret ==BATADV_DHCP_TO_CLIENT && -pskb_may_pull (skb, chaddr_offset +ETH_ALEN )) { +if (ret ==BATADV_DHCP_TO_CLIENT ) { +if (!pskb_may_pull (skb, chaddr_offset +ETH_ALEN )) +return BATADV_DHCP_NO ; +/* check if the DHCP packet carries an Ethernet DHCP */ p = skb->data + *header_len +BATADV_DHCP_HTYPE_OFFSET ;if (*p !=BATADV_DHCP_HTYPE_ETHERNET )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 11/62 batman-adv: bla: use netif_rx_ni when not in interrupt context
In reply to Greg Kroah-HartmanFrom: Jussi Kivilinna <[email protected]>
[ Upstream commit 279e89b2281af3b1a9f04906e157992c19c9f163 ]
batadv_bla_send_claim() gets called from worker thread context through batadv_bla_periodic_work(), thus netif_rx_ni needs to be used in that case. This fixes "NOHZ: local_softirq_pending 08" log messages seen when batman-adv is enabled.
--- net/batman-adv/bridge_loop_avoidance.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/batman-adv/bridge_loop_avoidance.c +4 -1
@@ -380,7 +380,10 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac, skb->len + ETH_HLEN); soft_iface->last_rx = jiffies; -netif_rx (skb); +if (in_interrupt ()) +netif_rx (skb); +else +netif_rx_ni (skb); out:if (primary_if)batadv_hardif_free_ref (primary_if);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 12/62 dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 0cef8e2c5a07d482ec907249dbd6687e8697677f ]
The reurn value of of_find_device_by_node() is not checked, thus null pointer dereference will be triggered if of_find_device_by_node() failed.
--- drivers/dma/at_hdmac.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/at_hdmac.c +2 -0
@@ -1817,6 +1817,8 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,return NULL ; dmac_pdev =of_find_device_by_node (dma_spec->np); +if (!dmac_pdev) +return NULL ;dma_cap_zero (mask);dma_cap_set (DMA_SLAVE , mask);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 13/62 netfilter: nf_tables: incorrect enum nft_list_attributes definition
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit da9125df854ea48a6240c66e8a67be06e2c12c03 ]
This should be NFTA_LIST_UNSPEC instead of NFTA_LIST_UNPEC, all other similar attribute definitions are postfixed with _UNSPEC.
--- include/uapi/linux/netfilter/nf_tables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/netfilter/nf_tables.h +1 -1
@@ -111,7 +111,7 @@ enum nf_tables_msg_types {* @NFTA_LIST_ELEM: list element (NLA_NESTED) */ enum nft_list_attributes { -NFTA_LIST_UNPEC , +NFTA_LIST_UNSPEC ,NFTA_LIST_ELEM , __NFTA_LIST_MAX };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 14/62 netfilter: nf_tables: fix destination register zeroing
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 1e105e6afa6c3d32bfb52c00ffa393894a525c27 ]
Following bug was reported via irc:
nft list ruleset
set knock_candidates_ipv4 {
type ipv4_addr . inet_service
size 65535
elements = { 127.0.0.1 . 123,
127.0.0.1 . 123 }
} ..
udp dport 123 add @knock_candidates_ipv4 { ip saddr . 123 } udp dport 123 add @knock_candidates_ipv4 { ip saddr . udp dport }
It should not have been possible to add a duplicate set entry.
After some debugging it turned out that the problem is the immediate value (123) in the second-to-last rule.
Concatenations use 32bit registers, i.e. the elements are 8 bytes each, not 6 and it turns out the kernel inserted
inet firewall @knock_candidates_ipv4
element 0100007f ffff7b00 : 0 [end]
element 0100007f 00007b00 : 0 [end]Note the non-zero upper bits of the first element. It turns out that nft_immediate doesn't zero the destination register, but this is needed when the length isn't a multiple of 4.
Furthermore, the zeroing in nft_payload is broken. We can't use [len / 4] = 0 -- if len is a multiple of 4, index is off by one.
Skip zeroing in this case and use a conditional instead of (len -1) / 4.
--- include/net/netfilter/nf_tables.h | 2 ++ net/netfilter/nft_payload.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)
include/net/netfilter/nf_tables.h +2 -0
@@ -74,6 +74,8 @@ struct nft_regs {static inline void nft_data_copy (u32 *dst,const struct nft_data *src,unsigned int len) { +if (len %NFT_REG32_SIZE ) + dst[len /NFT_REG32_SIZE ] =0 ;memcpy (dst, src, len); }
net/netfilter/nft_payload.c +3 -1
@@ -74,7 +74,9 @@ static void nft_payload_eval(const struct nft_expr *expr,u32 *dest = ®s->data[priv->dreg];int offset; - dest[priv->len /NFT_REG32_SIZE ] =0 ; +if (priv->len %NFT_REG32_SIZE ) + dest[priv->len /NFT_REG32_SIZE ] =0 ; +switch (priv->base) {case NFT_PAYLOAD_LL_HEADER :if (!skb_mac_header_was_set (skb))
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 15/62 dmaengine: pl330: Fix burst length if burst size is smaller than bus width
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 0661cef675d37e2c4b66a996389ebeae8568e49e ]
Move the burst len fixup after setting the generic value for it. This finally enables the fixup introduced by commit 137bd11090d8 ("dmaengine:
pl330: Align DMA memcpy operations to MFIFO width"), which otherwise was overwritten by the generic value.
--- drivers/dma/pl330.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/pl330.c +1 -1
@@ -2629,6 +2629,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,while (burst != (1 << desc->rqcfg.brst_size)) desc->rqcfg.brst_size++; + desc->rqcfg.brst_len =get_burst_len (desc, len);/* * If burst size is smaller than bus width then make sure we only * transfer one at a time to avoid a burst stradling an MFIFO entry.
@@ -2636,7 +2637,6 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,if (desc->rqcfg.brst_size *8 < pl330->pcfg.data_bus_width) desc->rqcfg.brst_len =1 ; - desc->rqcfg.brst_len =get_burst_len (desc, len); desc->bytes_requested = len; desc->txd.flags = flags;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 16/62 bnxt_en: Check for zero dir entries in NVRAM.
In reply to Greg Kroah-HartmanFrom: Vasundhara Volam <[email protected]>
[ Upstream commit dbbfa96ad920c50d58bcaefa57f5f33ceef9d00e ]
If firmware goes into unstable state, HWRM_NVM_GET_DIR_INFO firmware command may return zero dir entries. Return error in such case to avoid zero length dma buffer request.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +3 -0
@@ -991,6 +991,9 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data)if (rc !=0 )return rc; +if (!dir_entries || !entry_length) +return -EIO ; +/* Insert 2 bytes of directory info (count and size of entries) */ if (len <2 )return -EINVAL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 17/62 fix regression in "epoll: Keep a reference on files added to the check list"
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
[ Upstream commit 77f4689de17c0887775bb77896f4cc11a39bf848 ]
epoll_loop_check_proc() can run into a file already committed to destruction; we can't grab a reference on those and don't need to add them to the set for reverse path check anyway.
--- fs/eventpoll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/eventpoll.c +3 -3
@@ -1720,9 +1720,9 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)* during ep_insert(). */ if (list_empty (&epi->ffd.file->f_tfile_llink)) { -get_file (epi->ffd.file); -list_add (&epi->ffd.file->f_tfile_llink, - &tfile_check_list); +if (get_file_rcu (epi->ffd.file)) +list_add (&epi->ffd.file->f_tfile_llink, + &tfile_check_list); } } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 18/62 tg3: Fix soft lockup when tg3_reset_task() fails.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit 556699341efa98243e08e34401b3f601da91f5a3 ]
If tg3_reset_task() fails, the device state is left in an inconsistent state with IFF_RUNNING still set but NAPI state not enabled. A subsequent operation, such as ifdown or AER error can cause it to soft lock up when it tries to disable NAPI state.
Fix it by bringing down the device to !IFF_RUNNING state when tg3_reset_task() fails. tg3_reset_task() running from workqueue will now call tg3_close() when the reset fails. We need to modify tg3_reset_task_cancel() slightly to avoid tg3_close() calling cancel_work_sync() to cancel tg3_reset_task(). Otherwise cancel_work_sync() will wait forever for tg3_reset_task() to finish.
--- drivers/net/ethernet/broadcom/tg3.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +13 -4
@@ -7203,8 +7203,8 @@ static inline void tg3_reset_task_schedule(struct tg3 *tp)static inline void tg3_reset_task_cancel (struct tg3 *tp) { -cancel_work_sync (&tp->reset_task); -tg3_flag_clear (tp,RESET_TASK_PENDING ); +if (test_and_clear_bit (TG3_FLAG_RESET_TASK_PENDING , tp->tg3_flags)) +cancel_work_sync (&tp->reset_task);tg3_flag_clear (tp,TX_RECOVERY_PENDING ); }
@@ -11176,18 +11176,27 @@ static void tg3_reset_task(struct work_struct *work)tg3_halt (tp,RESET_KIND_SHUTDOWN ,0 ); err =tg3_init_hw (tp, true); -if (err) +if (err) { +tg3_full_unlock (tp); + tp->irq_sync =0 ; +tg3_napi_enable (tp); +/* Clear this flag so that tg3_reset_task_cancel() will not +* call cancel_work_sync() and wait forever. +*/ +tg3_flag_clear (tp,RESET_TASK_PENDING ); +dev_close (tp->dev); goto out; + }tg3_netif_start (tp); -out:tg3_full_unlock (tp);if (!err)tg3_phy_start (tp);tg3_flag_clear (tp,RESET_TASK_PENDING ); +out:rtnl_unlock (); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 19/62 iommu/vt-d: Serialize IOMMU GCMD register modifications
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 6e4e9ec65078093165463c13d4eb92b3e8d7b2e8 ]
The VT-d spec requires (10.4.4 Global Command Register, GCMD_REG General Description) that:
If multiple control fields in this register need to be modified, software must serialize the modifications through multiple writes to this register.
However, in irq_remapping.c, modifications of IRE and CFI are done in one write. We need to do two separate writes with STS checking after each. It also checks the status register before writing command register to avoid unnecessary register write.
--- drivers/iommu/intel_irq_remapping.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/iommu/intel_irq_remapping.c +8 -2
@@ -486,12 +486,18 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu)/* Enable interrupt-remapping */ iommu->gcmd |=DMA_GCMD_IRE ; - iommu->gcmd &= ~DMA_GCMD_CFI ;/* Block compatibility-format MSIs */ writel (iommu->gcmd, iommu->reg +DMAR_GCMD_REG ); -IOMMU_WAIT_OP (iommu,DMAR_GSTS_REG , readl, (sts &DMA_GSTS_IRES ), sts); +/* Block compatibility-format MSIs */ +if (sts &DMA_GSTS_CFIS ) { + iommu->gcmd &= ~DMA_GCMD_CFI ; +writel (iommu->gcmd, iommu->reg +DMAR_GCMD_REG ); +IOMMU_WAIT_OP (iommu,DMAR_GSTS_REG , + readl, !(sts &DMA_GSTS_CFIS ), sts); + } +/* * With CFI clear in the Global Command register, we should be * protected from dangerous (i.e. compatibility) interrupts
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 20/62 thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 30d24faba0532d6972df79a1bf060601994b5873 ]
We can sometimes get bogus thermal shutdowns on omap4430 at least with droid4 running idle with a battery charger connected:
thermal thermal_zone0: critical temperature reached (143 C), shutting down
Dumping out the register values shows we can occasionally get a 0x7f value that is outside the TRM listed values in the ADC conversion table. And then we get a normal value when reading again after that. Reading the register multiple times does not seem help avoiding the bogus values as they stay until the next sample is ready.
Looking at the TRM chapter "18.4.10.2.3 ADC Codes Versus Temperature", we should have values from 13 to 107 listed with a total of 95 values. But looking at the omap4430_adc_to_temp array, the values are off, and the end values are missing. And it seems that the 4430 ADC table is similar to omap3630 rather than omap4460.
Let's fix the issue by using values based on the omap3630 table and just ignoring invalid values. Compared to the 4430 TRM, the omap3630 table has the missing values added while the TRM table only shows every second value.
Note that sometimes the ADC register values within the valid table can also be way off for about 1 out of 10 values. But it seems that those just show about 25 C too low values rather than too high values. So those do not cause a bogus thermal shutdown.
--- .../ti-soc-thermal/omap4-thermal-data.c | 23 ++++++++++--------- .../thermal/ti-soc-thermal/omap4xxx-bandgap.h | 10 +++++--- 2 files changed, 19 insertions(+), 14 deletions(-)
drivers/thermal/ti-soc-thermal/omap4-thermal-data.c +12 -11
@@ -49,20 +49,21 @@ static struct temp_sensor_data omap4430_mpu_temp_sensor_data = {/* * Temperature values in milli degree celsius -* ADC code values from 530 to 923 +* ADC code values from 13 to 107, see TRM +* "18.4.10.2.3 ADC Codes Versus Temperature". */ static const int omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE -OMAP4430_ADC_START_VALUE +1 ] = { --38000 ,-35000 ,-34000 ,-32000 ,-30000 ,-28000 ,-26000 ,-24000 ,-22000 , --20000 ,-18000 ,-17000 ,-15000 ,-13000 ,-12000 ,-10000 ,-8000 ,-6000 , --5000 ,-3000 ,-1000 ,0 ,2000 ,3000 ,5000 ,6000 ,8000 ,10000 ,12000 , -13000 ,15000 ,17000 ,19000 ,21000 ,23000 ,25000 ,27000 ,28000 ,30000 , -32000 ,33000 ,35000 ,37000 ,38000 ,40000 ,42000 ,43000 ,45000 ,47000 , -48000 ,50000 ,52000 ,53000 ,55000 ,57000 ,58000 ,60000 ,62000 ,64000 , -66000 ,68000 ,70000 ,71000 ,73000 ,75000 ,77000 ,78000 ,80000 ,82000 , -83000 ,85000 ,87000 ,88000 ,90000 ,92000 ,93000 ,95000 ,97000 ,98000 , -100000 ,102000 ,103000 ,105000 ,107000 ,109000 ,111000 ,113000 ,115000 , -117000 ,118000 ,120000 ,122000 ,123000 , +-40000 ,-38000 ,-35000 ,-34000 ,-32000 ,-30000 ,-28000 ,-26000 ,-24000 , +-22000 ,-20000 ,-18500 ,-17000 ,-15000 ,-13500 ,-12000 ,-10000 ,-8000 , +-6500 ,-5000 ,-3500 ,-1500 ,0 ,2000 ,3500 ,5000 ,6500 ,8500 ,10000 , +12000 ,13500 ,15000 ,17000 ,19000 ,21000 ,23000 ,25000 ,27000 ,28500 , +30000 ,32000 ,33500 ,35000 ,37000 ,38500 ,40000 ,42000 ,43500 ,45000 , +47000 ,48500 ,50000 ,52000 ,53500 ,55000 ,57000 ,58500 ,60000 ,62000 , +64000 ,66000 ,68000 ,70000 ,71500 ,73500 ,75000 ,77000 ,78500 ,80000 , +82000 ,83500 ,85000 ,87000 ,88500 ,90000 ,92000 ,93500 ,95000 ,97000 , +98500 ,100000 ,102000 ,103500 ,105000 ,107000 ,109000 ,111000 ,113000 , +115000 ,117000 ,118500 ,120000 ,122000 ,123500 ,125000 , };/* OMAP4430 data */
drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h +7 -3
@@ -67,9 +67,13 @@* and thresholds for OMAP4430. */ -/* ADC conversion table limits */ -#define OMAP4430_ADC_START_VALUE 0 -#define OMAP4430_ADC_END_VALUE 127 +/* +* ADC conversion table limits. Ignore values outside the TRM listed +* range to avoid bogus thermal shutdowns. See omap4430 TRM chapter +* "18.4.10.2.3 ADC Codes Versus Temperature". +*/ +#define OMAP4430_ADC_START_VALUE 13 +#define OMAP4430_ADC_END_VALUE 107/* bandgap clock limits (no control on 4430) */ #define OMAP4430_MAX_FREQ 32768#define OMAP4430_MIN_FREQ 32768
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 21/62 include/linux/log2.h: add missing () around n in roundup_pow_of_two()
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 428fc0aff4e59399ec719ffcc1f7a5d29a4ee476 ]
Otherwise gcc generates warnings if the expression is complicated.
--- include/linux/log2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/log2.h +1 -1
@@ -159,7 +159,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)#define roundup_pow_of_two (n) \ ( \ __builtin_constant_p(n) ? ( \ - (n == 1) ? 1 : \ + ((n) == 1) ? 1 : \ (1UL << (ilog2((n) - 1) + 1)) \ ) : \ __roundup_pow_of_two(n) \
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 22/62 btrfs: drop path before adding new uuid tree entry
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 9771a5cf937129307d9f58922d60484d58ababe7 upstream.
With the conversion of the tree locks to rwsem I got the following lockdep splat:
======================================================
WARNING: possible circular locking dependency detected 5.8.0-rc7-00167-g0d7ba0c5b375-dirty #925 Not tainted
------------------------------------------------------
btrfs-uuid/7955 is trying to acquire lock:
ffff88bfbafec0f8 (btrfs-root-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
but task is already holding lock:
ffff88bfbafef2a8 (btrfs-uuid-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (btrfs-uuid-00){++++}-{3:3}:
down_read_nested+0x3e/0x140 __btrfs_tree_read_lock+0x39/0x180 __btrfs_read_lock_root_node+0x3a/0x50 btrfs_search_slot+0x4bd/0x990 btrfs_uuid_tree_add+0x89/0x2d0 btrfs_uuid_scan_kthread+0x330/0x390 kthread+0x133/0x150 ret_from_fork+0x1f/0x30
-> #0 (btrfs-root-00){++++}-{3:3}:
__lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 down_read_nested+0x3e/0x140 __btrfs_tree_read_lock+0x39/0x180 __btrfs_read_lock_root_node+0x3a/0x50 btrfs_search_slot+0x4bd/0x990 btrfs_find_root+0x45/0x1b0 btrfs_read_tree_root+0x61/0x100 btrfs_get_root_ref.part.50+0x143/0x630 btrfs_uuid_tree_iterate+0x207/0x314 btrfs_uuid_rescan_kthread+0x12/0x50 kthread+0x133/0x150 ret_from_fork+0x1f/0x30
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(btrfs-uuid-00);
lock(btrfs-root-00);
lock(btrfs-uuid-00);
lock(btrfs-root-00);*** DEADLOCK ***
1 lock held by btrfs-uuid/7955:
#0: ffff88bfbafef2a8 (btrfs-uuid-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
stack backtrace: CPU: 73 PID: 7955 Comm: btrfs-uuid Kdump: loaded Not tainted 5.8.0-rc7-00167-g0d7ba0c5b375-dirty #925 Hardware name: Quanta Tioga Pass Single Side 01-0030993006/Tioga Pass Single Side, BIOS F08_3A18 12/20/2018 Call Trace: dump_stack+0x78/0xa0 check_noncircular+0x165/0x180 __lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 ? __btrfs_tree_read_lock+0x39/0x180 ? btrfs_root_node+0x1c/0x1d0 down_read_nested+0x3e/0x140 ? __btrfs_tree_read_lock+0x39/0x180 __btrfs_tree_read_lock+0x39/0x180 __btrfs_read_lock_root_node+0x3a/0x50 btrfs_search_slot+0x4bd/0x990 btrfs_find_root+0x45/0x1b0 btrfs_read_tree_root+0x61/0x100 btrfs_get_root_ref.part.50+0x143/0x630 btrfs_uuid_tree_iterate+0x207/0x314 ? btree_readpage+0x20/0x20 btrfs_uuid_rescan_kthread+0x12/0x50 kthread+0x133/0x150 ? kthread_create_on_node+0x60/0x60 ret_from_fork+0x1f/0x30
This problem exists because we have two different rescan threads, btrfs_uuid_scan_kthread which creates the uuid tree, and btrfs_uuid_tree_iterate that goes through and updates or deletes any out of date roots. The problem is they both do things in different order. btrfs_uuid_scan_kthread() reads the tree_root, and then inserts entries into the uuid_root. btrfs_uuid_tree_iterate() scans the uuid_root, but then does a btrfs_get_fs_root() which can read from the tree_root.
It's actually easy enough to not be holding the path in btrfs_uuid_scan_kthread() when we add a uuid entry, as we already drop it further down and re-start the search when we loop. So simply move the path release before we add our entry to the uuid tree.
This also fixes a problem where we're holding a path open after we do btrfs_end_transaction(), which has it's own problems.
--- fs/btrfs/volumes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/volumes.c +2 -1
@@ -4065,6 +4065,7 @@ static int btrfs_uuid_scan_kthread(void goto skip; } update_tree: +btrfs_release_path (path);if (!btrfs_is_empty_uuid (root_item.uuid)) { ret = btrfs_uuid_tree_add(trans, fs_info->uuid_root, root_item.uuid,
@@ -4090,6 +4091,7 @@ update_tree: } skip: +btrfs_release_path (path);if (trans) { ret =btrfs_end_transaction (trans, fs_info->uuid_root); trans =NULL ;
@@ -4097,7 +4099,6 @@ skip:break ; } -btrfs_release_path (path);if (key.offset < (u64)-1 ) { key.offset++; }else if (key.type <BTRFS_ROOT_ITEM_KEY ) {
Greg Kroah-Hartman
maintainerPATCH 23/62 btrfs: Remove redundant extent_buffer_get in get_old_root
In reply to Greg Kroah-HartmanFrom: Nikolay Borisov <[email protected]>
[ Upstream commit 6c122e2a0c515cfb3f3a9cefb5dad4cb62109c78 ]
get_old_root used used only by btrfs_search_old_slot to initialise the path structure. The old root is always a cloned buffer (either via alloc dummy or via btrfs_clone_extent_buffer) and its reference count is 2: 1 from allocation, 1 from extent_buffer_get call in get_old_root.
This latter explicit ref count acquire operation is in fact unnecessary since the semantic is such that the newly allocated buffer is handed over to the btrfs_path for lifetime management. Considering this just remove the extra extent_buffer_get in get_old_root.
--- fs/btrfs/ctree.c | 1 - 1 file changed, 1 deletion(-)
fs/btrfs/ctree.c +0 -1
@@ -1441,7 +1441,6 @@ get_old_root(struct btrfs_root *root, u64 time_seq)if (!eb)return NULL ; -extent_buffer_get (eb);btrfs_tree_read_lock (eb);if (old_root) {btrfs_set_header_bytenr (eb, eb->start);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 24/62 btrfs: Remove extraneous extent_buffer_get from tree_mod_log_rewind
In reply to Greg Kroah-HartmanFrom: Nikolay Borisov <[email protected]>
[ Upstream commit 24cee18a1c1d7c731ea5987e0c99daea22ae7f4a ]
When a rewound buffer is created it already has a ref count of 1 and the dummy flag set. Then another ref is taken bumping the count to 2. Finally when this buffer is released from btrfs_release_path the extra reference is decremented by the special handling code in free_extent_buffer.
However, this special code is in fact redundant sinca ref count of 1 is still correct since the buffer is only accessed via btrfs_path struct. This paves the way forward of removing the special handling in free_extent_buffer.
--- fs/btrfs/ctree.c | 1 - 1 file changed, 1 deletion(-)
fs/btrfs/ctree.c +0 -1
@@ -1372,7 +1372,6 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path,btrfs_tree_read_unlock_blocking (eb);free_extent_buffer (eb); -extent_buffer_get (eb_rewin);btrfs_tree_read_lock (eb_rewin);__tree_mod_log_rewind (fs_info, eb_rewin, time_seq, tm); WARN_ON(btrfs_header_nritems(eb_rewin) >
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 25/62 btrfs: set the lockdep class for log tree extent buffers
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit d3beaa253fd6fa40b8b18a216398e6e5376a9d21 ]
These are special extent buffers that get rewound in order to lookup the state of the tree at a specific point in time. As such they do not go through the normal initialization paths that set their lockdep class, so handle them appropriately when they are created and before they are locked.
--- fs/btrfs/ctree.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/btrfs/ctree.c +5 -1
@@ -1372,6 +1372,8 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path,btrfs_tree_read_unlock_blocking (eb);free_extent_buffer (eb); +btrfs_set_buffer_lockdep_class (btrfs_header_owner (eb_rewin), + eb_rewin,btrfs_header_level (eb_rewin));btrfs_tree_read_lock (eb_rewin);__tree_mod_log_rewind (fs_info, eb_rewin, time_seq, tm); WARN_ON(btrfs_header_nritems(eb_rewin) >
@@ -1440,7 +1442,6 @@ get_old_root(struct btrfs_root *root, u64 time_seq)if (!eb)return NULL ; -btrfs_tree_read_lock (eb);if (old_root) {btrfs_set_header_bytenr (eb, eb->start);btrfs_set_header_backref_rev (eb,BTRFS_MIXED_BACKREF_REV );
@@ -1448,6 +1449,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq)btrfs_set_header_level (eb, old_root->level);btrfs_set_header_generation (eb, old_generation); } +btrfs_set_buffer_lockdep_class (btrfs_header_owner (eb), eb, +btrfs_header_level (eb)); +btrfs_tree_read_lock (eb);if (tm)__tree_mod_log_rewind (root->fs_info, eb, time_seq, tm);else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 26/62 uaccess: Add non-pagefault user-space read functions
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 3d7081822f7f9eab867d9bcc8fd635208ec438e0 ]
Add probe_user_read(), strncpy_from_unsafe_user() and strnlen_unsafe_user() which allows caller to access user-space in IRQ context.
Current probe_kernel_read() and strncpy_from_unsafe() are not available for user-space memory, because it sets KERNEL_DS while accessing data. On some arch, user address space and kernel address space can be co-exist, but others can not. In that case, setting KERNEL_DS means given address is treated as a kernel address space.
Also strnlen_user() is only available from user context since it can sleep if pagefault is enabled.
To access user-space memory without pagefault, we need these new functions which sets USER_DS while accessing the data.
--- include/linux/uaccess.h | 14 +++++ mm/maccess.c | 122 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 130 insertions(+), 6 deletions(-)
include/linux/uaccess.h +14 -0
@@ -90,6 +90,17 @@ static inline unsigned long __copy_from_user_nocache(void *to,extern long probe_kernel_read (void *dst,const void *src,size_t size);extern long __probe_kernel_read (void *dst,const void *src,size_t size); +/* +* probe_user_read(): safely attempt to read from a location in user space +* @dst: pointer to the buffer that shall take the data +* @src: address to read from +* @size: size of the data chunk +* +* Safely read from address @src to the buffer at @dst. If a kernel fault +* happens, handle that and return -EFAULT. +*/ +extern long probe_user_read (void *dst,const void __user *src,size_t size); +/* * probe_kernel_write(): safely attempt to write to a location * @dst: address to write to
@@ -103,6 +114,9 @@ extern long notrace probe_kernel_write(void *dst, const void *src, size_t size);extern long notrace __probe_kernel_write (void *dst,const void *src,size_t size);extern long strncpy_from_unsafe (char *dst,const void *unsafe_addr,long count); +extern long strncpy_from_unsafe_user (char *dst,const void __user *unsafe_addr, +long count); +extern long strnlen_unsafe_user (const void __user *unsafe_addr,long count);/** * probe_kernel_address(): safely attempt to read from a location
mm/maccess.c +116 -6
149 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 27/62 uaccess: Add non-pagefault user-space write function
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
[ Upstream commit 1d1585ca0f48fe7ed95c3571f3e4a82b2b5045dc ]
Commit 3d7081822f7f ("uaccess: Add non-pagefault user-space read functions") missed to add probe write function, therefore factor out a probe_write_common() helper with most logic of probe_kernel_write() except setting KERNEL_DS, and add a new probe_user_write() helper so it can be used from BPF side.
Again, on some archs, the user address space and kernel address space can co-exist and be overlapping, so in such case, setting KERNEL_DS would mean that the given address is treated as being in kernel address space.
--- include/linux/uaccess.h | 12 +++++++++++ mm/maccess.c | 45 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-)
include/linux/uaccess.h +12 -0
@@ -113,6 +113,18 @@ extern long probe_user_read(void *dst, const void __user *src, size_t size);extern long notrace probe_kernel_write (void *dst,const void *src,size_t size);extern long notrace __probe_kernel_write (void *dst,const void *src,size_t size); +/* +* probe_user_write(): safely attempt to write to a location in user space +* @dst: address to write to +* @src: pointer to the data that shall be written +* @size: size of the data chunk +* +* Safely write to address @dst from the buffer at @src. If a kernel fault +* happens, handle that and return -EFAULT. +*/ +extern long notrace probe_user_write (void __user *dst,const void *src,size_t size); +extern long notrace __probe_user_write (void __user *dst,const void *src,size_t size); +extern long strncpy_from_unsafe (char *dst,const void *unsafe_addr,long count);extern long strncpy_from_unsafe_user (char *dst,const void __user *unsafe_addr,long count);
mm/maccess.c +41 -4
68 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 28/62 btrfs: fix potential deadlock in the search ioctl
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit a48b73eca4ceb9b8a4b97f290a065335dbcd8a04 ]
With the conversion of the tree locks to rwsem I got the following lockdep splat:
======================================================
WARNING: possible circular locking dependency detected 5.8.0-rc7-00165-g04ec4da5f45f-dirty #922 Not tainted
------------------------------------------------------
compsize/11122 is trying to acquire lock:
ffff889fabca8768 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0x3e/0x90
but task is already holding lock:
ffff889fe720fe40 (btrfs-fs-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (btrfs-fs-00){++++}-{3:3}:
down_write_nested+0x3b/0x70 __btrfs_tree_lock+0x24/0x120 btrfs_search_slot+0x756/0x990 btrfs_lookup_inode+0x3a/0xb4 __btrfs_update_delayed_inode+0x93/0x270 btrfs_async_run_delayed_root+0x168/0x230 btrfs_work_helper+0xd4/0x570 process_one_work+0x2ad/0x5f0 worker_thread+0x3a/0x3d0 kthread+0x133/0x150 ret_from_fork+0x1f/0x30
-> #1 (&delayed_node->mutex){+.+.}-{3:3}:
__mutex_lock+0x9f/0x930 btrfs_delayed_update_inode+0x50/0x440 btrfs_update_inode+0x8a/0xf0 btrfs_dirty_inode+0x5b/0xd0 touch_atime+0xa1/0xd0 btrfs_file_mmap+0x3f/0x60 mmap_region+0x3a4/0x640 do_mmap+0x376/0x580 vm_mmap_pgoff+0xd5/0x120 ksys_mmap_pgoff+0x193/0x230 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
-> #0 (&mm->mmap_lock#2){++++}-{3:3}:
__lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 __might_fault+0x68/0x90 _copy_to_user+0x1e/0x80 copy_to_sk.isra.32+0x121/0x300 search_ioctl+0x106/0x200 btrfs_ioctl_tree_search_v2+0x7b/0xf0 btrfs_ioctl+0x106f/0x30a0 ksys_ioctl+0x83/0xc0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
other info that might help us debug this:
Chain exists of:
&mm->mmap_lock#2 --> &delayed_node->mutex --> btrfs-fs-00
Possible unsafe locking scenario: CPU0 CPU1
---- ----
lock(btrfs-fs-00);
lock(&delayed_node->mutex);
lock(btrfs-fs-00);
lock(&mm->mmap_lock#2);*** DEADLOCK ***
1 lock held by compsize/11122:
#0: ffff889fe720fe40 (btrfs-fs-00){++++}-{3:3}, at: __btrfs_tree_read_lock+0x39/0x180
stack backtrace: CPU: 17 PID: 11122 Comm: compsize Kdump: loaded Not tainted 5.8.0-rc7-00165-g04ec4da5f45f-dirty #922 Hardware name: Quanta Tioga Pass Single Side 01-0030993006/Tioga Pass Single Side, BIOS F08_3A18 12/20/2018 Call Trace: dump_stack+0x78/0xa0 check_noncircular+0x165/0x180 __lock_acquire+0x1272/0x2310 lock_acquire+0x9e/0x360 ? __might_fault+0x3e/0x90 ? find_held_lock+0x72/0x90 __might_fault+0x68/0x90 ? __might_fault+0x3e/0x90 _copy_to_user+0x1e/0x80 copy_to_sk.isra.32+0x121/0x300 ? btrfs_search_forward+0x2a6/0x360 search_ioctl+0x106/0x200 btrfs_ioctl_tree_search_v2+0x7b/0xf0 btrfs_ioctl+0x106f/0x30a0 ? __do_sys_newfstat+0x5a/0x70 ? ksys_ioctl+0x83/0xc0 ksys_ioctl+0x83/0xc0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x50/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9
The problem is we're doing a copy_to_user() while holding tree locks, which can deadlock if we have to do a page fault for the copy_to_user(). This exists even without my locking changes, so it needs to be fixed. Rework the search ioctl to do the pre-fault and then copy_to_user_nofault for the copying.
--- fs/btrfs/extent_io.c | 8 ++++---- fs/btrfs/extent_io.h | 6 +++--- fs/btrfs/ioctl.c | 27 ++++++++++++++++++++------- 3 files changed, 27 insertions(+), 14 deletions(-)
fs/btrfs/extent_io.c +4 -4
@@ -5431,9 +5431,9 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dstv, } } -int read_extent_buffer_to_user (const struct extent_buffer *eb, -void __user *dstv, -unsigned long start,unsigned long len) +int read_extent_buffer_to_user_nofault (const struct extent_buffer *eb, +void __user *dstv, +unsigned long start,unsigned long len) {size_t cur;size_t offset;
@@ -5454,7 +5454,7 @@ int read_extent_buffer_to_user(const struct extent_buffer *eb, cur =min (len, (PAGE_CACHE_SIZE - offset)); kaddr =page_address (page); -if (copy_to_user (dst, kaddr + offset, cur)) { +if (probe_user_write (dst, kaddr + offset, cur)) { ret = -EFAULT ;break ; }
fs/btrfs/extent_io.h +3 -3
@@ -313,9 +313,9 @@ int memcmp_extent_buffer(const struct extent_buffer *eb, const void *ptrv,void read_extent_buffer (const struct extent_buffer *eb,void *dst,unsigned long start,unsigned long len); -int read_extent_buffer_to_user (const struct extent_buffer *eb, -void __user *dst,unsigned long start, -unsigned long len); +int read_extent_buffer_to_user_nofault (const struct extent_buffer *eb, +void __user *dst,unsigned long start, +unsigned long len);void write_extent_buffer (struct extent_buffer *eb,const void *src,unsigned long start,unsigned long len); void copy_extent_buffer(struct extent_buffer *dst, struct extent_buffer *src,
fs/btrfs/ioctl.c +20 -7
@@ -2017,9 +2017,14 @@ static noinline int copy_to_sk(struct btrfs_root *root, sh.len = item_len; sh.transid = found_transid; -/* copy search result header */ -if (copy_to_user (ubuf + *sk_offset, &sh,sizeof (sh))) { - ret = -EFAULT ; +/* +* Copy search result header. If we fault then loop again so we +* can fault in the pages and -EFAULT there if there's a +* problem. Otherwise we'll fault and then copy the buffer in +* properly this next time through +*/ +if (probe_user_write (ubuf + *sk_offset, &sh,sizeof (sh))) { + ret =0 ; goto out; }
@@ -2027,10 +2032,14 @@ static noinline int copy_to_sk(struct btrfs_root *root,if (item_len) {char __user *up = ubuf + *sk_offset; -/* copy the item */ -if (read_extent_buffer_to_user (leaf, up, - item_off, item_len)) { - ret = -EFAULT ; +/* +* Copy the item, same behavior as above, but reset the +* * sk_offset so we copy the full thing again. +*/ +if (read_extent_buffer_to_user_nofault (leaf, up, + item_off, item_len)) { + ret =0 ; + *sk_offset -=sizeof (sh); goto out; }
@@ -2120,6 +2129,10 @@ static noinline int search_ioctl(struct inode *inode, key.offset = sk->min_offset;while (1 ) { + ret =fault_in_pages_writeable (ubuf, *buf_size - sk_offset); +if (ret) +break ; + ret =btrfs_search_forward (root, &key, path, sk->min_transid);if (ret !=0 ) {if (ret >0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 29/62 net: qmi_wwan: MDM9x30 specific power management
In reply to Greg Kroah-HartmanFrom: Bjørn Mork <[email protected]>
[ Upstream commit 93725149794d3d418cf1eddcae60c7b536c5faa1 ]
MDM9x30 based modems appear to go into a deeper sleep when suspended without "Remote Wakeup" enabled. The QMI interface will not respond unless a "set DTR" control request is sent on resume. The effect is similar to a QMI_CTL SYNC request, resetting (some of) the firmware state.
We allow userspace sessions to span multiple character device open/close sequences. This means that userspace can depend on firmware state while both the netdev and the character device are closed. We have disabled "needs_remote_wakeup" at this point to allow devices without remote wakeup support to be auto-suspended.
To make sure the MDM9x30 keeps firmware state, we need to keep "needs_remote_wakeup" always set. We also need to issue a "set DTR" request to enable the QMI interface.
--- drivers/net/usb/qmi_wwan.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/net/usb/qmi_wwan.c +38 -0
@@ -223,6 +223,20 @@ err:return rv; } +/* Send CDC SetControlLineState request, setting or clearing the DTR. +* "Required for Autoconnect and 9x30 to wake up" according to the +* GobiNet driver. The requirement has been verified on an MDM9230 +* based Sierra Wireless MC7455 +*/ +static int qmi_wwan_change_dtr (struct usbnet *dev,bool on) +{ +u8 intf = dev->intf->cur_altsetting->desc.bInterfaceNumber; + +return usbnet_write_cmd (dev,USB_CDC_REQ_SET_CONTROL_LINE_STATE , +USB_DIR_OUT |USB_TYPE_CLASS |USB_RECIP_INTERFACE , + on ?0x01 :0x00 , intf,NULL ,0 ); +} +static int qmi_wwan_bind (struct usbnet *dev,struct usb_interface *intf) {int status =-1 ;
@@ -280,6 +294,24 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)usb_driver_release_interface (driver, info->data); } +/* disabling remote wakeup on MDM9x30 devices has the same +* effect as clearing DTR. The device will not respond to QMI +* requests until we set DTR again. This is similar to a +* QMI_CTL SYNC request, clearing a lot of firmware state +* including the client ID allocations. +* +* Our usage model allows a session to span multiple +* open/close events, so we must prevent the firmware from +* clearing out state the clients might need. +* +* MDM9x30 is the first QMI chipset with USB3 support. Abuse +* this fact to enable the quirk. +*/ +if (le16_to_cpu (dev->udev->descriptor.bcdUSB) >=0x0201 ) { +qmi_wwan_manage_power (dev,1 ); +qmi_wwan_change_dtr (dev, true); + } +/* Never use the same address on both ends of the link, even if the * buggy firmware told us to. Or, if device is assigned the well-known * buggy firmware MAC address, replace it with a random address,
@@ -307,6 +339,12 @@ static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf)if (info->subdriver && info->subdriver->disconnect) info->subdriver->disconnect (info->control); +/* disable MDM9x30 quirk */ +if (le16_to_cpu (dev->udev->descriptor.bcdUSB) >=0x0201 ) { +qmi_wwan_change_dtr (dev, false); +qmi_wwan_manage_power (dev,0 ); + } +/* allow user to unbind using either control or data */ if (intf == info->control) other = info->data;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 30/62 net: qmi_wwan: support "raw IP" mode
In reply to Greg Kroah-HartmanFrom: Bjørn Mork <[email protected]>
[ Upstream commit 32f7adf633b9f99ad5089901bc7ebff57704aaa9 ]
QMI wwan devices have traditionally emulated ethernet devices by default. But they have always had the capability of operating without any L2 header at all, transmitting and receiving "raw" IP packets over the USB link. This firmware feature used to be configurable through the QMI management protocol.
Traditionally there was no way to verify the firmware mode without attempting to change it. And the firmware would often disallow changes anyway, i.e. due to a session already being established. In some cases, this could be a hidden firmware internal session, completely outside host control. For these reasons, sticking with the "well known" default mode was safest.
But newer generations of QMI hardware and firmware have moved towards defaulting to "raw IP" mode instead, followed by an increasing number of bugs in the already buggy "802.3" firmware implementation. At the same time, the QMI management protocol gained the ability to detect the current mode. This has enabled the userspace QMI management application to verify the current firmware mode without trying to modify it.
Following this development, the latest QMI hardware and firmware (the MDM9x30 generation) has dropped support for "802.3" mode entirely. Support for "raw IP" framing in the driver is therefore necessary for these devices, and to a certain degree to work around problems with the previous generation,
This patch adds support for "raw IP" framing for QMI devices, changing the netdev from an ethernet device to an ARPHRD_NONE p-t-p device when "raw IP" framing is enabled.
The firmware setup is fully delegated to the QMI userspace management application, through simple tunneling of the QMI protocol. The driver will therefore not know which mode has been "negotiated" between firmware and userspace. Allowing userspace to inform the driver of the result through a sysfs switch is considered a better alternative than to change the well established clean delegation of firmware management to userspace.
--- drivers/net/usb/qmi_wwan.c | 98 +++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-)
drivers/net/usb/qmi_wwan.c +97 -1
@@ -14,6 +14,7 @@#include <linux/netdevice.h> #include <linux/ethtool.h> #include <linux/etherdevice.h> +#include <linux/if_arp.h> #include <linux/mii.h> #include <linux/usb.h> #include <linux/usb/cdc.h>
@@ -48,11 +49,93 @@struct qmi_wwan_state {struct usb_driver *subdriver;atomic_t pmcount; -unsigned long unused; +unsigned long flags;struct usb_interface *control;struct usb_interface *data; }; +enum qmi_wwan_flags { +QMI_WWAN_FLAG_RAWIP =1 <<0 , +}; + +static void qmi_wwan_netdev_setup (struct net_device *net) +{ +struct usbnet *dev =netdev_priv (net); +struct qmi_wwan_state *info = (void *)&dev->data; + +if (info->flags &QMI_WWAN_FLAG_RAWIP ) { + net->header_ops =NULL ;/* No header */ + net->type =ARPHRD_NONE ; + net->hard_header_len =0 ; + net->addr_len =0 ; + net->flags =IFF_POINTOPOINT |IFF_NOARP |IFF_MULTICAST ; +netdev_dbg (net,"mode: raw IP\n" ); + }else if (!net->header_ops) {/* don't bother if already set */ +ether_setup (net); +netdev_dbg (net,"mode: Ethernet\n" ); + } + +/* recalculate buffers after changing hard_header_len */ +usbnet_change_mtu (net, net->mtu); +} + +static ssize_t raw_ip_show (struct device *d,struct device_attribute *attr,char *buf) +{ +struct usbnet *dev =netdev_priv (to_net_dev (d)); +struct qmi_wwan_state *info = (void *)&dev->data; + +return sprintf (buf,"%c\n" , info->flags &QMI_WWAN_FLAG_RAWIP ?'Y' :'N' ); +} + +static ssize_t raw_ip_store (struct device *d,struct device_attribute *attr,const char *buf,size_t len) +{ +struct usbnet *dev =netdev_priv (to_net_dev (d)); +struct qmi_wwan_state *info = (void *)&dev->data; +bool enable; +int err; + +if (strtobool (buf, &enable)) +return -EINVAL ; + +/* no change? */ +if (enable == (info->flags &QMI_WWAN_FLAG_RAWIP )) +return len; + +/* we don't want to modify a running netdev */ +if (netif_running (dev->net)) { +netdev_err (dev->net,"Cannot change a running device\n" ); +return -EBUSY ; + } + +/* let other drivers deny the change */ + err =call_netdevice_notifiers (NETDEV_PRE_TYPE_CHANGE , dev->net); + err =notifier_to_errno (err); +if (err) { +netdev_err (dev->net,"Type change was refused\n" ); +return err; + } + +if (enable) + info->flags |=QMI_WWAN_FLAG_RAWIP ; +else + info->flags &= ~QMI_WWAN_FLAG_RAWIP ; +qmi_wwan_netdev_setup (dev->net); +call_netdevice_notifiers (NETDEV_POST_TYPE_CHANGE , dev->net); +return len; +} + +static DEVICE_ATTR_RW (raw_ip); + +static struct attribute *qmi_wwan_sysfs_attrs[] = { + &dev_attr_raw_ip.attr, +NULL , +}; + +static struct attribute_group qmi_wwan_sysfs_attr_group = { + .name ="qmi" , + .attrs = qmi_wwan_sysfs_attrs, +}; +/* default ethernet address used by the modem */ static const u8 default_modem_addr[ETH_ALEN ] = {0x02 ,0x50 ,0xf3 };
@@ -80,6 +163,8 @@ static const u8 buggy_fw_addr[ETH_ALEN] = {0x00, 0xa0, 0xc6, 0x00, 0x00, 0x00};*/ static int qmi_wwan_rx_fixup (struct usbnet *dev,struct sk_buff *skb) { +struct qmi_wwan_state *info = (void *)&dev->data; +bool rawip = info->flags &QMI_WWAN_FLAG_RAWIP ;__be16 proto;/* This check is no longer done by usbnet */
@@ -94,15 +179,25 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) proto =htons (ETH_P_IPV6 );break ;case 0x00 : +if (rawip) +return 0 ;if (is_multicast_ether_addr (skb->data))return 1 ;/* possibly bogus destination - rewrite just in case */ skb_reset_mac_header (skb); goto fix_dest;default : +if (rawip) +return 0 ;/* pass along other packets without modifications */ return 1 ; } +if (rawip) { + skb->dev = dev->net;/* normally set by eth_type_trans */ + skb->protocol = proto; +return 1 ; + } +if (skb_headroom (skb) <ETH_HLEN )return 0 ;skb_push (skb,ETH_HLEN );
@@ -326,6 +421,7 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) dev->net->dev_addr[0 ] &=0xbf ;/* clear "IP" bit */ } dev->net->netdev_ops = &qmi_wwan_netdev_ops; + dev->net->sysfs_groups[0 ] = &qmi_wwan_sysfs_attr_group; err:return status; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 31/62 net: qmi_wwan: should hold RTNL while changing netdev type
In reply to Greg Kroah-HartmanFrom: Bjørn Mork <[email protected]>
[ Upstream commit 6c730080e663b1d629f8aa89348291fbcdc46cd9 ]
The notifier calls were thrown in as a last-minute fix for an imagined "this device could be part of a bridge" problem. That revealed a certain lack of locking. Not to mention testing...
Avoid this splat:
RTNL: assertion failed at net/core/dev.c (1639)
CPU: 0 PID: 4293 Comm: bash Not tainted 4.4.0-rc3+ #358 Hardware name: LENOVO 2776LEG/2776LEG, BIOS 6EET55WW (3.15 ) 12/19/2011 0000000000000000 ffff8800ad253d60 ffffffff8122f7cf ffff8800ad253d98 ffff8800ad253d88 ffffffff813833ab 0000000000000002 ffff880230f48560 ffff880230a12900 ffff8800ad253da0 ffffffff813833da 0000000000000002 Call Trace: [<ffffffff8122f7cf>] dump_stack+0x4b/0x63 [<ffffffff813833ab>] call_netdevice_notifiers_info+0x3d/0x59 [<ffffffff813833da>] call_netdevice_notifiers+0x13/0x15 [<ffffffffa09be227>] raw_ip_store+0x81/0x193 [qmi_wwan] [<ffffffff8131e149>] dev_attr_store+0x20/0x22 [<ffffffff811d858b>] sysfs_kf_write+0x49/0x50 [<ffffffff811d8027>] kernfs_fop_write+0x10a/0x151 [<ffffffff8117249a>] __vfs_write+0x26/0xa5 [<ffffffff81085ed4>] ? percpu_down_read+0x53/0x7f [<ffffffff81174c9e>] ? __sb_start_write+0x5f/0xb0 [<ffffffff81174c9e>] ? __sb_start_write+0x5f/0xb0 [<ffffffff81172c37>] vfs_write+0xa3/0xe7 [<ffffffff811734ad>] SyS_write+0x50/0x7e [<ffffffff8145c517>] entry_SYSCALL_64_fastpath+0x12/0x6f
--- drivers/net/usb/qmi_wwan.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/net/usb/qmi_wwan.c +15 -7
@@ -16,6 +16,7 @@#include <linux/etherdevice.h> #include <linux/if_arp.h> #include <linux/mii.h> +#include <linux/rtnetlink.h> #include <linux/usb.h> #include <linux/usb/cdc.h> #include <linux/usb/usbnet.h>
@@ -92,7 +93,7 @@ static ssize_t raw_ip_store(struct device *d, struct device_attribute *attr, costruct usbnet *dev =netdev_priv (to_net_dev (d));struct qmi_wwan_state *info = (void *)&dev->data;bool enable; -int err; +int ret;if (strtobool (buf, &enable))return -EINVAL ;
@@ -101,18 +102,22 @@ static ssize_t raw_ip_store(struct device *d, struct device_attribute *attr, coif (enable == (info->flags &QMI_WWAN_FLAG_RAWIP ))return len; +if (!rtnl_trylock ()) +return restart_syscall (); +/* we don't want to modify a running netdev */ if (netif_running (dev->net)) {netdev_err (dev->net,"Cannot change a running device\n" ); -return -EBUSY ; + ret = -EBUSY ; + goto err; }/* let other drivers deny the change */ - err =call_netdevice_notifiers (NETDEV_PRE_TYPE_CHANGE , dev->net); - err =notifier_to_errno (err); -if (err) { + ret =call_netdevice_notifiers (NETDEV_PRE_TYPE_CHANGE , dev->net); + ret =notifier_to_errno (ret); +if (ret) {netdev_err (dev->net,"Type change was refused\n" ); -return err; + goto err; }if (enable)
@@ -121,7 +126,10 @@ static ssize_t raw_ip_store(struct device *d, struct device_attribute *attr, co info->flags &= ~QMI_WWAN_FLAG_RAWIP ;qmi_wwan_netdev_setup (dev->net);call_netdevice_notifiers (NETDEV_POST_TYPE_CHANGE , dev->net); -return len; + ret = len; +err: +rtnl_unlock (); +return ret; }static DEVICE_ATTR_RW (raw_ip);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 32/62 net: qmi_wwan: ignore bogus CDC Union descriptors
In reply to Greg Kroah-HartmanFrom: Bjørn Mork <[email protected]>
[ Upstream commit 34a55d5e858e81a20d33fd9490149d6a1058be0c ]
The CDC descriptors found on these vendor specific functions should not be considered authoritative. They seem to be ignored by drivers for other systems, and the quality is therefore low.
One device (1e0e:9001) has been reported to have such a bogus union descriptor on the QMI function, making it fail probing even if the device id was dynamically added. The report was not complete enough to allow adding a device entry for this modem. But this should at least fix the dynamic id probing problem.
--- drivers/net/usb/qmi_wwan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/usb/qmi_wwan.c +4 -1
@@ -374,7 +374,10 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)"bogus CDC Union: master=%u, slave=%u\n" , cdc_union->bMasterInterface0, cdc_union->bSlaveInterface0); - goto err; + +/* ignore and continue... */ + cdc_union =NULL ; + info->data = intf; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 33/62 Add Dell Wireless 5809e Gobi 4G HSPA+ Mobile Broadband Card (rev3) to qmi_wwan
In reply to Greg Kroah-HartmanFrom: Patrik Halfar <[email protected]>
[ Upstream commit fb5eb24cdd5cdb83be77d3e4b2f16e92e06bd9e9 ]
New revison of Dell Wireless 5809e Gobi 4G HSPA+ Mobile Broadband Card has new idProduct
Bus 002 Device 006: ID 413c:81b3 Dell Computer Corp. Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x413c Dell Computer Corp. idProduct 0x81b3 bcdDevice 0.06 iManufacturer 1 Sierra Wireless, Incorporated iProduct 2 Dell Wireless 5809e Gobi™ 4G HSPA+ Mobile Broadband Card iSerial 3 bNumConfigurations 2
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -913,6 +913,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */ + {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */ {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 34/62 qmi_wwan: Added support for Gemaltos Cinterion PHxx WWAN interface
In reply to Greg Kroah-HartmanFrom: Schemmel Hans-Christoph <[email protected]>
[ Upstream commit bd9e33508c5e1eb5d807d11d7bfc52125fcdb04e ]
Added support for Gemalto's Cinterion PHxx WWAN interfaces by adding QMI_FIXED_INTF with Cinterion's VID and PID.
PHxx can have:
2 RmNet Interfaces (PID 0x0082) or
1 RmNet + 1 USB Audio interface (PID 0x0083).
--- drivers/net/usb/qmi_wwan.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/usb/qmi_wwan.c +3 -0
@@ -907,6 +907,9 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x0b3c, 0xc00b, 4)}, /* Olivetti Olicard 500 */ {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */ + {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */ + {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */ + {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/ {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 35/62 qmi_wwan: add support for Quectel EC21 and EC25
In reply to Greg Kroah-HartmanFrom: Bjørn Mork <[email protected]>
[ Upstream commit 9a765881bf3dcd32847d7108cf48cb04a4ed993f ]
The Quectel EC21 and EC25 need the same "set DTR" request as devices based on the MDM9230 chipset, but has no USB3 support. Our best guess is that the "set DTR" functionality depends on chipset and/or baseband firmware generation. But USB3 is still an optional feature.
Since we cannot enable this unconditionally for all older devices, and there doesn't appear to be anything we can use in the USB descriptors to identify these chips, we are forced to use a device specific quirk flag.
--- drivers/net/usb/qmi_wwan.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
drivers/net/usb/qmi_wwan.c +28 -2
@@ -59,6 +59,10 @@ enum qmi_wwan_flags { QMI_WWAN_FLAG_RAWIP = 1 << 0, }; +enum qmi_wwan_quirks { +QMI_WWAN_QUIRK_DTR =1 <<0 ,/* needs "set DTR" request */ +}; +static void qmi_wwan_netdev_setup (struct net_device *net) {struct usbnet *dev =netdev_priv (net);
@@ -411,9 +415,14 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)* clearing out state the clients might need. * * MDM9x30 is the first QMI chipset with USB3 support. Abuse -* this fact to enable the quirk. +* this fact to enable the quirk for all USB3 devices. +* +* There are also chipsets with the same "set DTR" requirement +* but without USB3 support. Devices based on these chips +* need a quirk flag in the device ID table. */ -if (le16_to_cpu (dev->udev->descriptor.bcdUSB) >=0x0201 ) { +if (dev->driver_info->data &QMI_WWAN_QUIRK_DTR || +le16_to_cpu (dev->udev->descriptor.bcdUSB) >=0x0201 ) {qmi_wwan_manage_power (dev,1 );qmi_wwan_change_dtr (dev, true); }
@@ -526,6 +535,16 @@ static const struct driver_info qmi_wwan_info = { .rx_fixup = qmi_wwan_rx_fixup, }; +static const struct driver_info qmi_wwan_info_quirk_dtr = { + .description ="WWAN/QMI device" , + .flags =FLAG_WWAN , + .bind = qmi_wwan_bind, + .unbind = qmi_wwan_unbind, + .manage_power = qmi_wwan_manage_power, + .rx_fixup = qmi_wwan_rx_fixup, + .data =QMI_WWAN_QUIRK_DTR , +}; +#define HUAWEI_VENDOR_ID 0x12D1/* map QMI/wwan function by a fixed interface number */
@@ -533,6 +552,11 @@ static const struct driver_info qmi_wwan_info = { USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \ .driver_info = (unsigned long)&qmi_wwan_info +/* devices requiring "set DTR" quirk */ +#define QMI_QUIRK_SET_DTR (vend, prod, num) \ + USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \ + .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr +/* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ #define QMI_GOBI1K_DEVICE (vend, prod) \ QMI_FIXED_INTF(vend, prod, 3)
@@ -921,6 +945,8 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */ {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */ + {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ + {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe *//* 4. Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 36/62 NET: usb: qmi_wwan: add support for Telit LE922A PID 0x1040
In reply to Greg Kroah-HartmanFrom: Daniele Palmas <[email protected]>
[ Upstream commit 9bd813da24cd49d749911d7fdc0e9ae9a673d746 ]
This patch adds support for PID 0x1040 of Telit LE922A.
The qmi adapter requires to have DTR set for proper working, so QMI_WWAN_QUIRK_DTR has been enabled.
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -919,6 +919,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */ {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 37/62 drivers: net: usb: qmi_wwan: add QMI_QUIRK_SET_DTR for Telit PID 0x1201
In reply to Greg Kroah-HartmanFrom: Daniele Palmas <[email protected]>
[ Upstream commit 14cf4a771b3098e431d2677e3533bdd962e478d8 ]
Telit LE920A4 uses the same pid 0x1201 of LE920, but modem implementation is different, since it requires DTR to be set for answering to qmi messages.
This patch replaces QMI_FIXED_INTF with QMI_QUIRK_SET_DTR: tests on LE920 have been performed in order to verify backward compatibility.
--- drivers/net/usb/qmi_wwan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/qmi_wwan.c +1 -1
@@ -921,7 +921,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ - {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */ {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */ {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 38/62 usb: qmi_wwan: add D-Link DWM-222 A2 device ID
In reply to Greg Kroah-HartmanFrom: Rogan Dawes <[email protected]>
[ Upstream commit 7d6053097311643545a8118100175a39bd6fa637 ]
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -886,6 +886,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ + {QMI_FIXED_INTF(0x2001, 0x7e3d, 4)}, /* D-Link DWM-222 A2 */ {QMI_FIXED_INTF(0x2020, 0x2031, 4)}, /* Olicard 600 */ {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */ {QMI_FIXED_INTF(0x2020, 0x2060, 4)}, /* BroadMobi BM818 */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 39/62 net: usb: qmi_wwan: add Telit ME910 support
In reply to Greg Kroah-HartmanFrom: Daniele Palmas <[email protected]>
[ Upstream commit 4c54dc0277d0d55a9248c43aebd31858f926a056 ]
This patch adds support for Telit ME910 PID 0x1100.
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -921,6 +921,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ + {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 40/62 net: usb: qmi_wwan: add Telit 0x1050 composition
In reply to Greg Kroah-HartmanFrom: Daniele Palmas <[email protected]>
[ Upstream commit e0ae2c578d3909e60e9448207f5d83f785f1129f ]
This patch adds support for Telit FN980 0x1050 composition
0x1050: tty, adb, rmnet, tty, tty, tty, tty
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -921,6 +921,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */ {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 41/62 ALSA: ca0106: fix error code handling
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
commit ee0761d1d8222bcc5c86bf10849dc86cf008557c upstream.
snd_ca0106_spi_write() returns 1 on error, snd_ca0106_pcm_power_dac() is returning the error code directly, and the caller is expecting an negative error code
--- sound/pci/ca0106/ca0106_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ca0106/ca0106_main.c +2 -1
@@ -551,7 +551,8 @@ static int snd_ca0106_pcm_power_dac(struelse /* Power down */ chip->spi_dac_reg[reg] |= bit; -return snd_ca0106_spi_write (chip, chip->spi_dac_reg[reg]); +if (snd_ca0106_spi_write (chip, chip->spi_dac_reg[reg]) !=0 ) +return -ENXIO ; }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 42/62 ALSA: pcm: oss: Remove superfluous WARN_ON() for mulaw sanity check
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 949a1ebe8cea7b342085cb6a4946b498306b9493 upstream.
The PCM OSS mulaw plugin has a check of the format of the counter part whether it's a linear format. The check is with snd_BUG_ON() that emits WARN_ON() when the debug config is set, and it confuses syzkaller as if it were a serious issue. Let's drop snd_BUG_ON() for avoiding that.
While we're at it, correct the error code to a more suitable, EINVAL.
--- sound/core/oss/mulaw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/oss/mulaw.c +2 -2
@@ -329,8 +329,8 @@ int snd_pcm_plugin_build_mulaw(struct snsnd_BUG ();return -EINVAL ; } -if (snd_BUG_ON (!snd_pcm_format_linear (format->format))) -return -ENXIO ; +if (!snd_pcm_format_linear (format->format)) +return -EINVAL ; err = snd_pcm_plugin_build(plug, "Mu-Law<->linear conversion", src_format, dst_format,
Greg Kroah-Hartman
maintainerPATCH 43/62 dm cache metadata: Avoid returning cmd->bm wild pointer on error
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit d16ff19e69ab57e08bf908faaacbceaf660249de upstream.
Maybe __create_persistent_data_objects() caller will use PTR_ERR as a pointer, it will lead to some strange things.
--- drivers/md/dm-cache-metadata.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/md/dm-cache-metadata.c +6 -2
@@ -501,12 +501,16 @@ static int __create_persistent_data_obje CACHE_MAX_CONCURRENT_LOCKS);if (IS_ERR (cmd->bm)) {DMERR ("could not create block manager" ); -return PTR_ERR (cmd->bm); + r =PTR_ERR (cmd->bm); + cmd->bm =NULL ; +return r; } r =__open_or_format_metadata (cmd, may_format_device); -if (r) +if (r) {dm_block_manager_destroy (cmd->bm); + cmd->bm =NULL ; + }return r; }
Greg Kroah-Hartman
maintainerPATCH 44/62 dm thin metadata: Avoid returning cmd->bm wild pointer on error
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit 219403d7e56f9b716ad80ab87db85d29547ee73e upstream.
Maybe __create_persistent_data_objects() caller will use PTR_ERR as a pointer, it will lead to some strange things.
--- drivers/md/dm-thin-metadata.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/md/dm-thin-metadata.c +6 -2
@@ -700,12 +700,16 @@ static int __create_persistent_data_obje THIN_MAX_CONCURRENT_LOCKS);if (IS_ERR (pmd->bm)) {DMERR ("could not create block manager" ); -return PTR_ERR (pmd->bm); + r =PTR_ERR (pmd->bm); + pmd->bm =NULL ; +return r; } r =__open_or_format_metadata (pmd, format_device); -if (r) +if (r) {dm_block_manager_destroy (pmd->bm); + pmd->bm =NULL ; + }return r; }
Greg Kroah-Hartman
maintainerPATCH 45/62 net: refactor bind_bucket fastreuse into helper
In reply to Greg Kroah-HartmanFrom: Tim Froidcoeur <[email protected]>
commit 62ffc589abb176821662efc4525ee4ac0b9c3894 upstream.
Refactor the fastreuse update code in inet_csk_get_port into a small helper function that can be called from other places.
--- include/net/inet_connection_sock.h | 4 +++ net/ipv4/inet_connection_sock.c | 46 ++++++++++++++++++++++--------------- 2 files changed, 32 insertions(+), 18 deletions(-)
include/net/inet_connection_sock.h +4 -0
@@ -319,5 +319,9 @@ int inet_csk_compat_getsockopt(struct soint inet_csk_compat_setsockopt (struct sock *sk,int level,int optname,char __user *optval,unsigned int optlen); +/* update the fast reuse flag when adding a socket */ +void inet_csk_update_fastreuse (struct inet_bind_bucket *tb, +struct sock *sk); +struct dst_entry *inet_csk_update_pmtu (struct sock *sk,u32 mtu);#endif /* _INET_CONNECTION_SOCK_H */
net/ipv4/inet_connection_sock.c +28 -18
58 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 46/62 net: initialize fastreuse on inet_inherit_port
In reply to Greg Kroah-HartmanFrom: Tim Froidcoeur <[email protected]>
commit d76f3351cea2d927fdf70dd7c06898235035e84e upstream.
In the case of TPROXY, bind_conflict optimizations for SO_REUSEADDR or SO_REUSEPORT are broken, possibly resulting in O(n) instead of O(1) bind behaviour or in the incorrect reuse of a bind.
the kernel keeps track for each bind_bucket if all sockets in the bind_bucket support SO_REUSEADDR or SO_REUSEPORT in two fastreuse flags. These flags allow skipping the costly bind_conflict check when possible (meaning when all sockets have the proper SO_REUSE option).
For every socket added to a bind_bucket, these flags need to be updated. As soon as a socket that does not support reuse is added, the flag is set to false and will never go back to true, unless the bind_bucket is deleted.
Note that there is no mechanism to re-evaluate these flags when a socket is removed (this might make sense when removing a socket that would not allow reuse; this leaves room for a future patch).
For this optimization to work, it is mandatory that these flags are properly initialized and updated.
When a child socket is created from a listen socket in __inet_inherit_port, the TPROXY case could create a new bind bucket without properly initializing these flags, thus preventing the optimization to work. Alternatively, a socket not allowing reuse could be added to an existing bind bucket without updating the flags, causing bind_conflict to never be called as it should.
Call inet_csk_update_fastreuse when __inet_inherit_port decides to create a new bind_bucket or use a different bind_bucket than the one of the listen socket.
--- net/ipv4/inet_hashtables.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/inet_hashtables.c +1 -0
@@ -160,6 +160,7 @@ int __inet_inherit_port(const struct socreturn -ENOMEM ; } } +inet_csk_update_fastreuse (tb, child); }inet_bind_hash (child, tb, port);spin_unlock (&head->lock);
Greg Kroah-Hartman
maintainerPATCH 47/62 checkpatch: fix the usage of capture group ( ... )
In reply to Greg Kroah-HartmanFrom: Mrinal Pandey <[email protected]>
commit 13e45417cedbfc44b1926124b1846f5ee8c6ba4a upstream.
The usage of "capture group (...)" in the immediate condition after && results in $1 being uninitialized. This issues a warning "Use of uninitialized value $1 in regexp compilation at ./scripts/checkpatch.pl line 2638".
I noticed this bug while running checkpatch on the set of commits from v5.7 to v5.8-rc1 of the kernel on the commits with a diff content in their commit message.
This bug was introduced in the script by commit e518e9a59ec3 ("checkpatch: emit an error when there's a diff in a changelog"). It has been in the script since then.
The author intended to store the match made by capture group in variable $1. This should have contained the name of the file as [\w/]+ matched. However, this couldn't be accomplished due to usage of capture group and $1 in the same regular expression.
Fix this by placing the capture group in the condition before &&. Thus, $1 can be initialized to the text that capture group matches thereby setting it to the desired and required value.
--- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +2 -2
@@ -2195,8 +2195,8 @@ sub process { # Check if the commit log has what seems like a diff which can confuse patch if ($in_commit_log && !$commit_log_has_diff && - (($line =~ m@^\s+diff\b.*a/[\w/]+@ && - $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) || + (($line =~ m@^\s+diff\b.*a/([\w/]+)@ && + $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) || $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ || $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) { ERROR("DIFF_IN_COMMIT_MSG",
Greg Kroah-Hartman
maintainerPATCH 48/62 mm/hugetlb: fix a race between hugetlb sysctl handlers
In reply to Greg Kroah-HartmanFrom: Muchun Song <[email protected]>
commit 17743798d81238ab13050e8e2833699b54e15467 upstream.
There is a race between the assignment of table->data and write value to the pointer of table->data in the __do_proc_doulongvec_minmax() on the other thread.
CPU0: CPU1:
proc_sys_write
hugetlb_sysctl_handler proc_sys_call_handler
hugetlb_sysctl_handler_common hugetlb_sysctl_handler
table->data = &tmp; hugetlb_sysctl_handler_common
table->data = &tmp;
proc_doulongvec_minmax
do_proc_doulongvec_minmax sysctl_head_finish
__do_proc_doulongvec_minmax unuse_table
i = table->data;
*i = val; // corrupt CPU1's stackFix this by duplicating the table, and only update the duplicate of it. And introduce a helper of proc_hugetlb_doulongvec_minmax() to simplify the code.
The following oops was seen:
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
Code: Bad RIP value.
...
Call Trace:
? set_max_huge_pages+0x3da/0x4f0
? alloc_pool_huge_page+0x150/0x150
? proc_doulongvec_minmax+0x46/0x60
? hugetlb_sysctl_handler_common+0x1c7/0x200
? nr_hugepages_store+0x20/0x20
? copy_fd_bitmaps+0x170/0x170
? hugetlb_sysctl_handler+0x1e/0x20
? proc_sys_call_handler+0x2f1/0x300
? unregister_sysctl_table+0xb0/0xb0
? __fd_install+0x78/0x100
? proc_sys_write+0x14/0x20
? __vfs_write+0x4d/0x90
? vfs_write+0xef/0x240
? ksys_write+0xc0/0x160
? __ia32_sys_read+0x50/0x50
? __close_fd+0x129/0x150
? __x64_sys_write+0x43/0x50
? do_syscall_64+0x6c/0x200
? entry_SYSCALL_64_after_hwframe+0x44/0xa9--- mm/hugetlb.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
mm/hugetlb.c +20 -6
@@ -2812,6 +2812,22 @@ static unsigned int cpuset_mems_nr(unsig }#ifdef CONFIG_SYSCTL +static int proc_hugetlb_doulongvec_minmax (struct ctl_table *table,int write, +void *buffer,size_t *length, +loff_t *ppos,unsigned long *out) +{ +struct ctl_table dup_table; + +/* +* In order to avoid races with __do_proc_doulongvec_minmax(), we +* can duplicate the @table and alter the duplicate of it. +*/ + dup_table = *table; + dup_table.data = out; + +return proc_doulongvec_minmax (&dup_table, write, buffer, length, ppos); +} +static int hugetlb_sysctl_handler_common (bool obey_mempolicy,struct ctl_table *table,int write,void __user *buffer,size_t *length,loff_t *ppos)
@@ -2823,9 +2839,8 @@ static int hugetlb_sysctl_handler_commonif (!hugepages_supported ())return -ENOTSUPP ; - table->data = &tmp; - table->maxlen =sizeof (unsigned long ); - ret =proc_doulongvec_minmax (table, write, buffer, length, ppos); + ret =proc_hugetlb_doulongvec_minmax (table, write, buffer, length, ppos, + &tmp);if (ret) goto out;
@@ -2869,9 +2884,8 @@ int hugetlb_overcommit_handler(struct ctif (write &&hstate_is_gigantic (h))return -EINVAL ; - table->data = &tmp; - table->maxlen =sizeof (unsigned long ); - ret =proc_doulongvec_minmax (table, write, buffer, length, ppos); + ret =proc_hugetlb_doulongvec_minmax (table, write, buffer, length, ppos, + &tmp);if (ret) goto out;
Greg Kroah-Hartman
maintainerPATCH 49/62 cfg80211: regulatory: reject invalid hints
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 47caf685a6854593348f216e0b489b71c10cbe03 upstream.
Reject invalid hints early in order to not cause a kernel WARN later if they're restored to or similar.
--- net/wireless/reg.c | 3 +++ 1 file changed, 3 insertions(+)
net/wireless/reg.c +3 -0
@@ -2383,6 +2383,9 @@ int regulatory_hint_user(const char *alpif (WARN_ON (!alpha2))return -EINVAL ; +if (!is_world_regdom (alpha2) && !is_an_alpha2 (alpha2)) +return -EINVAL ; + request =kzalloc (sizeof (struct regulatory_request ),GFP_KERNEL );if (!request)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 50/62 net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
In reply to Greg Kroah-HartmanFrom: Himadri Pandya <[email protected]>
commit a092b7233f0e000cc6f2c71a49e2ecc6f917a5fc upstream.
The buffer size is 2 Bytes and we expect to receive the same amount of data. But sometimes we receive less data and run into uninit-was-stored issue upon read. Hence modify the error check on the return value to match with the buffer size as a prevention.
Reported-and-tested by: [email protected]
--- drivers/net/usb/asix_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/asix_common.c +1 -1
@@ -251,7 +251,7 @@ int asix_read_phy_addr(struct usbnet *denetdev_dbg (dev->net,"asix_get_phy_addr()\n" ); -if (ret <0 ) { +if (ret <2 ) {netdev_err (dev->net,"Error reading PHYID register: %02x\n" , ret); goto out; }
Greg Kroah-Hartman
maintainerPATCH 51/62 ALSA: firewire-digi00x: add support for console models of Digi00x series
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit 13e005f9f933a35b5e55c9d36f151efe2a8383ec ]
Digi00x series includes two types of unit; rack and console. As long as reading information on config rom of Digi 002 console, 'MODEL_ID' field has a different value from the one on Digi 002 rack.
We've already got a test report from users with Digi 003 rack. We can assume that console type and rack type has different value in the field.
This commit adds a device entry for console type. For following commits, this commit also adds a member to 'struct snd_digi00x' to identify console type.
$ cd linux-firewire-utils/src
$ python2 ./crpp < /sys/bus/firewire/devices/fw1/config_rom
ROM header and bus information block
-----------------------------------------------------------------
400 0404f9d0 bus_info_length 4, crc_length 4, crc 63952
404 31333934 bus_name "1394"
408 60647002 irmc 0, cmc 1, isc 1, bmc 0, cyc_clk_acc 100, max_rec 7 (256)
40c 00a07e00 company_id 00a07e |
410 00a30000 device_id 0000a30000 | EUI-64 00a07e0000a30000 root directory
-----------------------------------------------------------------
414 00058a39 directory_length 5, crc 35385
418 0c0043a0 node capabilities
41c 04000001 hardware version
420 0300a07e vendor
424 81000007 --> descriptor leaf at 440
428 d1000001 --> unit directory at 42c unit directory at 42c
-----------------------------------------------------------------
42c 00046674 directory_length 4, crc 26228 430 120000a3 specifier id 434 13000001 version 438 17000001 model 43c 81000007 --> descriptor leaf at 458
descriptor leaf at 440
-----------------------------------------------------------------
440 00055913 leaf_length 5, crc 22803 444 000050f2 descriptor_type 00, specifier_ID 50f2 448 80000000 44c 44696769 450 64657369 454 676e0000
descriptor leaf at 458
-----------------------------------------------------------------
458 0004a6fd leaf_length 4, crc 42749 45c 00000000 textual descriptor 460 00000000 minimal ASCII 464 44696769 "Digi" 468 20303032 " 002"
--- sound/firewire/digi00x/digi00x.c | 13 +++++++++++-- sound/firewire/digi00x/digi00x.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-)
sound/firewire/digi00x/digi00x.c +11 -2
@@ -13,7 +13,8 @@ MODULE_AUTHOR("Takashi Sakamoto <[email protected]>");MODULE_LICENSE ("GPL v2" );#define VENDOR_DIGIDESIGN 0x00a07e -#define MODEL_DIGI00X 0x000002 +#define MODEL_CONSOLE 0x000001 +#define MODEL_RACK 0x000002static int name_card (struct snd_dg00x *dg00x) {
@@ -75,6 +76,8 @@ static int snd_dg00x_probe(struct fw_unit *unit,spin_lock_init (&dg00x->lock);init_waitqueue_head (&dg00x->hwdep_wait); + dg00x->is_console = entry->model_id ==MODEL_CONSOLE ; + err =name_card (dg00x);if (err <0 ) goto error;
@@ -138,7 +141,13 @@ static const struct ieee1394_device_id snd_dg00x_id_table[] = { .match_flags = IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID, .vendor_id = VENDOR_DIGIDESIGN, - .model_id = MODEL_DIGI00X, + .model_id = MODEL_CONSOLE, + }, + { + .match_flags = IEEE1394_MATCH_VENDOR_ID | + IEEE1394_MATCH_MODEL_ID, + .vendor_id = VENDOR_DIGIDESIGN, + .model_id = MODEL_RACK, }, {} };
sound/firewire/digi00x/digi00x.h +1 -0
@@ -57,6 +57,7 @@ struct snd_dg00x {/* For asynchronous MIDI controls. */ struct snd_rawmidi_substream *in_control;struct snd_fw_async_midi_port out_control; +bool is_console; };#define DG00X_ADDR_BASE 0xffffe0000000ull
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 52/62 ALSA: firewire-digi00x: exclude Avid Adrenaline from detection
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit acd46a6b6de88569654567810acad2b0a0a25cea ]
Avid Adrenaline is reported that ALSA firewire-digi00x driver is bound to. However, as long as he investigated, the design of this model is hardly similar to the one of Digi 00x family. It's better to exclude the model from modalias of ALSA firewire-digi00x driver.
This commit changes device entries so that the model is excluded.
$ python3 crpp < ~/git/am-config-rom/misc/avid-adrenaline.img
ROM header and bus information block
-----------------------------------------------------------------
400 04203a9c bus_info_length 4, crc_length 32, crc 15004
404 31333934 bus_name "1394"
408 e064a002 irmc 1, cmc 1, isc 1, bmc 0, cyc_clk_acc 100, max_rec 10 (2048)
40c 00a07e01 company_id 00a07e |
410 00085257 device_id 0100085257 | EUI-64 00a07e0100085257 root directory
-----------------------------------------------------------------
414 0005d08c directory_length 5, crc 53388
418 0300a07e vendor
41c 8100000c --> descriptor leaf at 44c
420 0c008380 node capabilities
424 8d000002 --> eui-64 leaf at 42c
428 d1000004 --> unit directory at 438 eui-64 leaf at 42c
-----------------------------------------------------------------
42c 0002410f leaf_length 2, crc 16655
430 00a07e01 company_id 00a07e |
434 00085257 device_id 0100085257 | EUI-64 00a07e0100085257 unit directory at 438
-----------------------------------------------------------------
438 0004d6c9 directory_length 4, crc 54985 43c 1200a02d specifier id: 1394 TA 440 13014001 version: Vender Unique and AV/C 444 17000001 model 448 81000009 --> descriptor leaf at 46c
descriptor leaf at 44c
-----------------------------------------------------------------
44c 00077205 leaf_length 7, crc 29189 450 00000000 textual descriptor 454 00000000 minimal ASCII 458 41766964 "Avid" 45c 20546563 " Tec" 460 686e6f6c "hnol" 464 6f677900 "ogy" 468 00000000
descriptor leaf at 46c
-----------------------------------------------------------------
46c 000599a5 leaf_length 5, crc 39333 470 00000000 textual descriptor 474 00000000 minimal ASCII 478 41647265 "Adre" 47c 6e616c69 "nali" 480 6e650000 "ne"
--- sound/firewire/digi00x/digi00x.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/firewire/digi00x/digi00x.c +5 -0
@@ -15,6 +15,7 @@ MODULE_LICENSE("GPL v2");#define VENDOR_DIGIDESIGN 0x00a07e#define MODEL_CONSOLE 0x000001#define MODEL_RACK 0x000002 +#define SPEC_VERSION 0x000001static int name_card (struct snd_dg00x *dg00x) {
@@ -139,14 +140,18 @@ static const struct ieee1394_device_id snd_dg00x_id_table[] = {/* Both of 002/003 use the same ID. */ { .match_flags = IEEE1394_MATCH_VENDOR_ID | + IEEE1394_MATCH_VERSION | IEEE1394_MATCH_MODEL_ID, .vendor_id = VENDOR_DIGIDESIGN, + .version = SPEC_VERSION, .model_id = MODEL_CONSOLE, }, { .match_flags = IEEE1394_MATCH_VENDOR_ID | + IEEE1394_MATCH_VERSION | IEEE1394_MATCH_MODEL_ID, .vendor_id = VENDOR_DIGIDESIGN, + .version = SPEC_VERSION, .model_id = MODEL_RACK, }, {}
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 53/62 ALSA; firewire-tascam: exclude Tascam FE-8 from detection
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
Tascam FE-8 is known to support communication by asynchronous transaction only. The support can be implemented in userspace application and snd-firewire-ctl-services project has the support. However, ALSA firewire-tascam driver is bound to the model.
This commit changes device entries so that the model is excluded. In a commit 53b3ffee7885 ("ALSA: firewire-tascam: change device probing processing"), I addressed to the concern that version field in configuration differs depending on installed firmware. However, as long as I checked, the version number is fixed. It's safe to return version number back to modalias.
--- sound/firewire/tascam/tascam.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
sound/firewire/tascam/tascam.c +29 -1
@@ -172,11 +172,39 @@ static void snd_tscm_remove(struct fw_unit *unit) }static const struct ieee1394_device_id snd_tscm_id_table[] = { +// Tascam, FW-1884. { .match_flags =IEEE1394_MATCH_VENDOR_ID | -IEEE1394_MATCH_SPECIFIER_ID , +IEEE1394_MATCH_SPECIFIER_ID | +IEEE1394_MATCH_VERSION , .vendor_id =0x00022e , .specifier_id =0x00022e , + .version =0x800000 , + }, +// Tascam, FE-8 (.version = 0x800001) +// This kernel module doesn't support FE-8 because the most of features +// can be implemented in userspace without any specific support of this +// module. +// +// .version = 0x800002 is unknown. +// +// Tascam, FW-1082. + { + .match_flags =IEEE1394_MATCH_VENDOR_ID | +IEEE1394_MATCH_SPECIFIER_ID | +IEEE1394_MATCH_VERSION , + .vendor_id =0x00022e , + .specifier_id =0x00022e , + .version =0x800003 , + }, +// Tascam, FW-1804. + { + .match_flags =IEEE1394_MATCH_VENDOR_ID | +IEEE1394_MATCH_SPECIFIER_ID | +IEEE1394_MATCH_VERSION , + .vendor_id =0x00022e , + .specifier_id =0x00022e , + .version =0x800004 , },/* FE-08 requires reverse-engineering because it just has faders. */ {}
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 54/62 fs/affs: use octal for permissions
In reply to Greg Kroah-HartmanFrom: Fabian Frederick <[email protected]>
[ Upstream commit 1bafd6f164d9ec9bf2fa9829051fbeb36342be0b ]
According to commit f90774e1fd27 ("checkpatch: look for symbolic permissions and suggest octal instead")
--- fs/affs/amigaffs.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
fs/affs/amigaffs.c +18 -18
@@ -390,23 +390,23 @@ prot_to_mode(u32 prot)umode_t mode =0 ;if (!(prot &FIBF_NOWRITE )) - mode |=S_IWUSR ; + mode |=0200 ;if (!(prot &FIBF_NOREAD )) - mode |=S_IRUSR ; + mode |=0400 ;if (!(prot &FIBF_NOEXECUTE )) - mode |=S_IXUSR ; + mode |=0100 ;if (prot &FIBF_GRP_WRITE ) - mode |=S_IWGRP ; + mode |=0020 ;if (prot &FIBF_GRP_READ ) - mode |=S_IRGRP ; + mode |=0040 ;if (prot &FIBF_GRP_EXECUTE ) - mode |=S_IXGRP ; + mode |=0010 ;if (prot &FIBF_OTR_WRITE ) - mode |=S_IWOTH ; + mode |=0002 ;if (prot &FIBF_OTR_READ ) - mode |=S_IROTH ; + mode |=0004 ;if (prot &FIBF_OTR_EXECUTE ) - mode |=S_IXOTH ; + mode |=0001 ;return mode; }
@@ -417,23 +417,23 @@ mode_to_prot(struct inode *inode)u32 prot =AFFS_I (inode)->i_protect;umode_t mode = inode->i_mode; -if (!(mode &S_IXUSR )) +if (!(mode &0100 )) prot |=FIBF_NOEXECUTE ; -if (!(mode &S_IRUSR )) +if (!(mode &0400 )) prot |=FIBF_NOREAD ; -if (!(mode &S_IWUSR )) +if (!(mode &0200 )) prot |=FIBF_NOWRITE ; -if (mode &S_IXGRP ) +if (mode &0010 ) prot |=FIBF_GRP_EXECUTE ; -if (mode &S_IRGRP ) +if (mode &0040 ) prot |=FIBF_GRP_READ ; -if (mode &S_IWGRP ) +if (mode &0020 ) prot |=FIBF_GRP_WRITE ; -if (mode &S_IXOTH ) +if (mode &0001 ) prot |=FIBF_OTR_EXECUTE ; -if (mode &S_IROTH ) +if (mode &0004 ) prot |=FIBF_OTR_READ ; -if (mode &S_IWOTH ) +if (mode &0002 ) prot |=FIBF_OTR_WRITE ;AFFS_I (inode)->i_protect = prot;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 55/62 affs: fix basic permission bits to actually work
In reply to Greg Kroah-HartmanFrom: Max Staudt <[email protected]>
[ Upstream commit d3a84a8d0dde4e26bc084b36ffcbdc5932ac85e2 ]
The basic permission bits (protection bits in AmigaOS) have been broken in Linux' AFFS - it would only set bits, but never delete them. Also, contrary to the documentation, the Archived bit was not handled.
Let's fix this for good, and set the bits such that Linux and classic AmigaOS can coexist in the most peaceful manner.
Also, update the documentation to represent the current state of things.
--- Documentation/filesystems/affs.txt | 16 ++++++++++------ fs/affs/amigaffs.c | 27 +++++++++++++++++++++++++++ fs/affs/file.c | 26 +++++++++++++++++++++++++- 3 files changed, 62 insertions(+), 7 deletions(-)
Documentation/filesystems/affs.txt +10 -6
@@ -93,13 +93,15 @@ The Amiga protection flags RWEDRWEDHSPARWED are handled as follows: - R maps to r for user, group and others. On directories, R implies x. - - If both W and D are allowed, w will be set. + - W maps to w. - E maps to x. - - H and P are always retained and ignored under Linux. + - D is ignored. - - A is always reset when a file is written to. + - H, S and P are always retained and ignored under Linux. + + - A is cleared when a file is written to. User id and group id will be used unless set[gu]id are given as mount options. Since most of the Amiga file systems are single user systems
@@ -111,11 +113,13 @@ Linux -> Amiga: The Linux rwxrwxrwx file mode is handled as follows: - - r permission will set R for user, group and others. + - r permission will allow R for user, group and others. + + - w permission will allow W for user, group and others. - - w permission will set W and D for user, group and others. + - x permission of the user will allow E for plain files. - - x permission of the user will set E for plain files. + - D will be allowed for user, group and others. - All other flags (suid, sgid, ...) are ignored and will not be retained.
fs/affs/amigaffs.c +27 -0
@@ -417,24 +417,51 @@ mode_to_prot(struct inode *inode)u32 prot =AFFS_I (inode)->i_protect;umode_t mode = inode->i_mode; +/* +* First, clear all RWED bits for owner, group, other. +* Then, recalculate them afresh. +* +* We'll always clear the delete-inhibit bit for the owner, as that is +* the classic single-user mode AmigaOS protection bit and we need to +* stay compatible with all scenarios. +* +* Since multi-user AmigaOS is an extension, we'll only set the +* delete-allow bit if any of the other bits in the same user class +* (group/other) are used. +*/ + prot &= ~(FIBF_NOEXECUTE |FIBF_NOREAD + |FIBF_NOWRITE |FIBF_NODELETE + |FIBF_GRP_EXECUTE |FIBF_GRP_READ + |FIBF_GRP_WRITE |FIBF_GRP_DELETE + |FIBF_OTR_EXECUTE |FIBF_OTR_READ + |FIBF_OTR_WRITE |FIBF_OTR_DELETE ); + +/* Classic single-user AmigaOS flags. These are inverted. */ if (!(mode &0100 )) prot |=FIBF_NOEXECUTE ;if (!(mode &0400 )) prot |=FIBF_NOREAD ;if (!(mode &0200 )) prot |=FIBF_NOWRITE ; + +/* Multi-user extended flags. Not inverted. */ if (mode &0010 ) prot |=FIBF_GRP_EXECUTE ;if (mode &0040 ) prot |=FIBF_GRP_READ ;if (mode &0020 ) prot |=FIBF_GRP_WRITE ; +if (mode &0070 ) + prot |=FIBF_GRP_DELETE ; +if (mode &0001 ) prot |=FIBF_OTR_EXECUTE ;if (mode &0004 ) prot |=FIBF_OTR_READ ;if (mode &0002 ) prot |=FIBF_OTR_WRITE ; +if (mode &0007 ) + prot |=FIBF_OTR_DELETE ;AFFS_I (inode)->i_protect = prot; }
fs/affs/file.c +25 -1
@@ -426,6 +426,24 @@ static int affs_write_begin(struct file *file, struct address_space *mapping,return ret; } +static int affs_write_end (struct file *file,struct address_space *mapping, +loff_t pos,unsigned int len,unsigned int copied, +struct page *page,void *fsdata) +{ +struct inode *inode = mapping->host; +int ret; + + ret =generic_write_end (file, mapping, pos, len, copied, page, fsdata); + +/* Clear Archived bit on file writes, as AmigaOS would do */ +if (AFFS_I (inode)->i_protect &FIBF_ARCHIVED ) { +AFFS_I (inode)->i_protect &= ~FIBF_ARCHIVED ; +mark_inode_dirty (inode); + } + +return ret; +} +static sector_t _affs_bmap (struct address_space *mapping,sector_t block) {return generic_block_bmap (mapping,block,affs_get_block);
@@ -435,7 +453,7 @@ const struct address_space_operations affs_aops = { .readpage = affs_readpage, .writepage = affs_writepage, .write_begin = affs_write_begin, - .write_end = generic_write_end, + .write_end = affs_write_end, .direct_IO = affs_direct_IO, .bmap = _affs_bmap };
@@ -793,6 +811,12 @@ done:if (tmp > inode->i_size) inode->i_size =AFFS_I (inode)->mmu_private = tmp; +/* Clear Archived bit on file writes, as AmigaOS would do */ +if (AFFS_I (inode)->i_protect &FIBF_ARCHIVED ) { +AFFS_I (inode)->i_protect &= ~FIBF_ARCHIVED ; +mark_inode_dirty (inode); + } + err_first_bh:unlock_page (page);page_cache_release (page);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 56/62 ravb: Fixed to be able to unload modules
In reply to Greg Kroah-HartmanFrom: Yuusuke Ashizuka <[email protected]>
commit 1838d6c62f57836639bd3d83e7855e0ee4f6defc upstream.
When this driver is built as a module, I cannot rmmod it after insmoding it.
This is because that this driver calls ravb_mdio_init() at the time of probe, and module->refcnt is incremented by alloc_mdio_bitbang() called after that.
Therefore, even if ifup is not performed, the driver is in use and rmmod cannot be performed.
$ lsmod Module Size Used by ravb 40960 1 $ rmmod ravb rmmod: ERROR: Module ravb is in use
Call ravb_mdio_init() at open and free_mdio_bitbang() at close, thereby rmmod is possible in the ifdown state.
--- drivers/net/ethernet/renesas/ravb_main.c | 110 +++++++++++++++---------------- 1 file changed, 55 insertions(+), 55 deletions(-)
drivers/net/ethernet/renesas/ravb_main.c +55 -55
@@ -1214,12 +1214,64 @@ static const struct ethtool_ops ravb_eth .get_ts_info = ravb_get_ts_info, }; +/* MDIO bus init function */ +static int ravb_mdio_init (struct ravb_private *priv) +{ +struct platform_device *pdev = priv->pdev; +struct device *dev = &pdev->dev; +int error; + +/* Bitbang init */ + priv->mdiobb.ops = &bb_ops; + +/* MII controller setting */ + priv->mii_bus =alloc_mdio_bitbang (&priv->mdiobb); +if (!priv->mii_bus) +return -ENOMEM ; + +/* Hook up MII support for ethtool */ + priv->mii_bus->name ="ravb_mii" ; + priv->mii_bus->parent = dev; +snprintf (priv->mii_bus->id,MII_BUS_ID_SIZE ,"%s-%x" , + pdev->name, pdev->id); + +/* Register MDIO bus */ + error =of_mdiobus_register (priv->mii_bus, dev->of_node); +if (error) + goto out_free_bus; + +return 0 ; + +out_free_bus: +free_mdio_bitbang (priv->mii_bus); +return error; +} + +/* MDIO bus release function */ +static int ravb_mdio_release (struct ravb_private *priv) +{ +/* Unregister mdio bus */ +mdiobus_unregister (priv->mii_bus); + +/* Free bitbang info */ +free_mdio_bitbang (priv->mii_bus); + +return 0 ; +} +/* Network device open function for Ethernet AVB */ static int ravb_open (struct net_device *ndev) {struct ravb_private *priv =netdev_priv (ndev);int error; +/* MDIO bus init */ + error =ravb_mdio_init (priv); +if (error) { +netdev_err (ndev,"failed to initialize MDIO\n" ); +return error; + } +napi_enable (&priv->napi[RAVB_BE ]);napi_enable (&priv->napi[RAVB_NC ]);
@@ -1268,6 +1320,7 @@ out_free_irq: out_napi_off:napi_disable (&priv->napi[RAVB_NC ]);napi_disable (&priv->napi[RAVB_BE ]); +ravb_mdio_release (priv);return error; }
@@ -1561,6 +1614,8 @@ static int ravb_close(struct net_deviceravb_ring_free (ndev,RAVB_BE );ravb_ring_free (ndev,RAVB_NC ); +ravb_mdio_release (priv); +return 0 ; }
@@ -1664,51 +1719,6 @@ static const struct net_device_ops ravb_ .ndo_change_mtu = eth_change_mtu, }; -/* MDIO bus init function */ -static int ravb_mdio_init (struct ravb_private *priv) -{ -struct platform_device *pdev = priv->pdev; -struct device *dev = &pdev->dev; -int error; - -/* Bitbang init */ - priv->mdiobb.ops = &bb_ops; - -/* MII controller setting */ - priv->mii_bus =alloc_mdio_bitbang (&priv->mdiobb); -if (!priv->mii_bus) -return -ENOMEM ; - -/* Hook up MII support for ethtool */ - priv->mii_bus->name ="ravb_mii" ; - priv->mii_bus->parent = dev; -snprintf (priv->mii_bus->id,MII_BUS_ID_SIZE ,"%s-%x" , - pdev->name, pdev->id); - -/* Register MDIO bus */ - error =of_mdiobus_register (priv->mii_bus, dev->of_node); -if (error) - goto out_free_bus; - -return 0 ; - -out_free_bus: -free_mdio_bitbang (priv->mii_bus); -return error; -} - -/* MDIO bus release function */ -static int ravb_mdio_release (struct ravb_private *priv) -{ -/* Unregister mdio bus */ -mdiobus_unregister (priv->mii_bus); - -/* Free bitbang info */ -free_mdio_bitbang (priv->mii_bus); - -return 0 ; -} -static const struct of_device_id ravb_match_table[] = { { .compatible ="renesas,etheravb-r8a7790" , .data = (void *)RCAR_GEN2 }, { .compatible ="renesas,etheravb-r8a7794" , .data = (void *)RCAR_GEN2 },
@@ -1847,13 +1857,6 @@ static int ravb_probe(struct platform_deeth_hw_addr_random (ndev); } -/* MDIO bus init */ - error =ravb_mdio_init (priv); -if (error) { -dev_err (&pdev->dev,"failed to initialize MDIO\n" ); - goto out_dma_free; - } -netif_napi_add (ndev, &priv->napi[RAVB_BE ], ravb_poll,64 );netif_napi_add (ndev, &priv->napi[RAVB_NC ], ravb_poll,64 );
@@ -1873,8 +1876,6 @@ static int ravb_probe(struct platform_de out_napi_del:netif_napi_del (&priv->napi[RAVB_NC ]);netif_napi_del (&priv->napi[RAVB_BE ]); -ravb_mdio_release (priv); -out_dma_free:dma_free_coherent (ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, priv->desc_bat_dma); out_release:
@@ -1899,7 +1900,6 @@ static int ravb_remove(struct platform_dunregister_netdev (ndev);netif_napi_del (&priv->napi[RAVB_NC ]);netif_napi_del (&priv->napi[RAVB_BE ]); -ravb_mdio_release (priv);pm_runtime_disable (&pdev->dev);free_netdev (ndev);platform_set_drvdata (pdev,NULL );
Greg Kroah-Hartman
maintainerPATCH 57/62 net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()
In reply to Greg Kroah-HartmanFrom: Shung-Hsi Yu <[email protected]>
commit cbedcb044e9cc4e14bbe6658111224bb923094f4 upstream.
On machines with much memory (> 2 TByte) and log_mtts_per_seg == 0, a max_order of 31 will be passed to mlx_buddy_init(), which results in s = BITS_TO_LONGS(1 << 31) becoming a negative value, leading to kvmalloc_array() failure when it is converted to size_t.
mlx4_core 0000:b1:00.0: Failed to initialize memory region table, aborting
mlx4_core: probe of 0000:b1:00.0 failed with error -12
Fix this issue by changing the left shifting operand from a signed literal to an unsigned one.
--- drivers/net/ethernet/mellanox/mlx4/mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/mr.c +1 -1
@@ -114,7 +114,7 @@ static int mlx4_buddy_init(struct mlx4_b goto err_out;for (i =0 ; i <= buddy->max_order; ++i) { - s =BITS_TO_LONGS (1 << (buddy->max_order - i)); + s =BITS_TO_LONGS (1UL << (buddy->max_order - i)); buddy->bits[i] =kcalloc (s,sizeof (long ),GFP_KERNEL | __GFP_NOWARN);if (!buddy->bits[i]) { buddy->bits[i] =vzalloc (s *sizeof (long ));
Greg Kroah-Hartman
maintainerPATCH 58/62 bnxt_en: Failure to update PHY is not fatal condition.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
commit ba41d46fe03223279054e58d570069fdc62fb768 upstream.
If we fail to update the PHY, we should print a warning and continue. The current code to exit is buggy as it has not freed up the NIC resources yet.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -4623,7 +4623,7 @@ static int __bnxt_open_nic(struct bnxt *if (link_re_init) { rc =bnxt_update_phy_setting (bp);if (rc) - goto open_err; +netdev_warn (bp->dev,"failed to update phy settings\n" ); }if (irq_re_init) {
Greg Kroah-Hartman
maintainerPATCH 59/62 bnxt: dont enable NAPI until rings are ready
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
commit 96ecdcc992eb7f468b2cf829b0f5408a1fad4668 upstream.
Netpoll can try to poll napi as soon as napi_enable() is called. It crashes trying to access a doorbell which is still NULL:
BUG: kernel NULL pointer dereference, address: 0000000000000000 CPU: 59 PID: 6039 Comm: ethtool Kdump: loaded Tainted: G S 5.9.0-rc1-00469-g5fd99b5d9950-dirty #26 RIP: 0010:bnxt_poll+0x121/0x1c0 Code: c4 20 44 89 e0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 41 8b 86 a0 01 00 00 41 23 85 18 01 00 00 49 8b 96 a8 01 00 00 0d 00 00 00 24 <89> 02 41 f6 45 77 02 74 cb 49 8b ae d8 01 00 00 31 c0 c7 44 24 1a netpoll_poll_dev+0xbd/0x1a0 __netpoll_send_skb+0x1b2/0x210 netpoll_send_udp+0x2c9/0x406 write_ext_msg+0x1d7/0x1f0 console_unlock+0x23c/0x520 vprintk_emit+0xe0/0x1d0 printk+0x58/0x6f x86_vector_activate.cold+0xf/0x46 __irq_domain_activate_irq+0x50/0x80 __irq_domain_activate_irq+0x32/0x80 __irq_domain_activate_irq+0x32/0x80 irq_domain_activate_irq+0x25/0x40 __setup_irq+0x2d2/0x700 request_threaded_irq+0xfb/0x160 __bnxt_open_nic+0x3b1/0x750 bnxt_open_nic+0x19/0x30 ethtool_set_channels+0x1ac/0x220 dev_ethtool+0x11ba/0x2240 dev_ioctl+0x1cf/0x390 sock_do_ioctl+0x95/0x130
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -6
@@ -4612,14 +4612,14 @@ static int __bnxt_open_nic(struct bnxt * } } -bnxt_enable_napi (bp); - rc =bnxt_init_nic (bp, irq_re_init);if (rc) {netdev_err (bp->dev,"bnxt_init_nic err: %x\n" , rc); - goto open_err; + goto open_err_irq; } +bnxt_enable_napi (bp); +if (link_re_init) { rc =bnxt_update_phy_setting (bp);if (rc)
@@ -4644,9 +4644,6 @@ static int __bnxt_open_nic(struct bnxt *return 0 ; -open_err: -bnxt_disable_napi (bp); - open_err_irq:bnxt_del_napi (bp);
Greg Kroah-Hartman
maintainerPATCH 60/62 net: usb: dm9601: Add USB ID of Keenetic Plus DSL
In reply to Greg Kroah-HartmanFrom: Kamil Lorenc <[email protected]>
[ Upstream commit a609d0259183a841621f252e067f40f8cc25d6f6 ]
Keenetic Plus DSL is a xDSL modem that uses dm9620 as its USB interface.
--- drivers/net/usb/dm9601.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/usb/dm9601.c +4 -0
@@ -624,6 +624,10 @@ static const struct usb_device_id produc USB_DEVICE(0x0a46, 0x1269), /* DM9621A USB to Fast Ethernet Adapter */ .driver_info = (unsigned long)&dm9601_info, }, + { + USB_DEVICE(0x0586, 0x3427), /* ZyXEL Keenetic Plus DSL xDSL modem */ + .driver_info = (unsigned long)&dm9601_info, + }, {}, // END };
Greg Kroah-Hartman
maintainerPATCH 61/62 sctp: not disable bh in the whole sctp_get_port_local()
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 3106ecb43a05dc3e009779764b9da245a5d082de ]
With disabling bh in the whole sctp_get_port_local(), when snum == 0 and too many ports have been used, the do-while loop will take the cpu for a long time and cause cpu stuck:
[ ] watchdog: BUG: soft lockup - CPU#11 stuck for 22s! [ ] RIP: 0010:native_queued_spin_lock_slowpath+0x4de/0x940 [ ] Call Trace:
[ ] _raw_spin_lock+0xc1/0xd0 [ ] sctp_get_port_local+0x527/0x650 [sctp] [ ] sctp_do_bind+0x208/0x5e0 [sctp] [ ] sctp_autobind+0x165/0x1e0 [sctp] [ ] sctp_connect_new_asoc+0x355/0x480 [sctp] [ ] __sctp_connect+0x360/0xb10 [sctp]
There's no need to disable bh in the whole function of sctp_get_port_local. So fix this cpu stuck by removing local_bh_disable() called at the beginning, and using spin_lock_bh() instead.
The same thing was actually done for inet_csk_get_port() in Commit ea8add2b1903 ("tcp/dccp: better use of ephemeral ports in bind()").
Thanks to Marcelo for pointing the buggy code out.
v1->v2:
- use cond_resched() to yield cpu to other tasks if needed, as Eric noticed.
--- net/sctp/socket.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
net/sctp/socket.c +6 -10
@@ -6206,8 +6206,6 @@ static long sctp_get_port_local(struct spr_debug ("%s: begins, snum:%d\n" , __func__, snum); -local_bh_disable (); -if (snum ==0 ) {/* Search for an available port. */ int low, high, remaining, index;
@@ -6226,20 +6224,21 @@ static long sctp_get_port_local(struct scontinue ; index =sctp_phashfn (sock_net (sk), rover); head = &sctp_port_hashtable[index]; -spin_lock (&head->lock); +spin_lock_bh (&head->lock);sctp_for_each_hentry (pp, &head->chain)if ((pp->port == rover) &&net_eq (sock_net (sk), pp->net)) goto next;break ; next: -spin_unlock (&head->lock); +spin_unlock_bh (&head->lock); +cond_resched (); }while (--remaining >0 );/* Exhausted local port range during search? */ ret =1 ;if (remaining <=0 ) - goto fail; +return ret;/* OK, here is the one we will use. HEAD (the port * hash table list entry) is non-NULL and we hold it's
@@ -6254,7 +6253,7 @@ static long sctp_get_port_local(struct s* port iterator, pp being NULL. */ head = &sctp_port_hashtable[sctp_phashfn (sock_net (sk), snum)]; -spin_lock (&head->lock); +spin_lock_bh (&head->lock);sctp_for_each_hentry (pp, &head->chain) {if ((pp->port == snum) &&net_eq (pp->net,sock_net (sk))) goto pp_found;
@@ -6338,10 +6337,7 @@ success: ret =0 ; fail_unlock: -spin_unlock (&head->lock); - -fail: -local_bh_enable (); +spin_unlock_bh (&head->lock);return ret; }
Greg Kroah-Hartman
maintainerPATCH 62/62 net: disable netpoll on fresh napis
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 96e97bc07e90f175a8980a22827faf702ca4cb30 ]
napi_disable() makes sure to set the NAPI_STATE_NPSVC bit to prevent netpoll from accessing rings before init is complete. However, the same is not done for fresh napi instances in netif_napi_add(), even though we expect NAPI instances to be added as disabled.
This causes crashes during driver reconfiguration (enabling XDP, changing the channel count) - if there is any printk() after netif_napi_add() but before napi_enable().
To ensure memory ordering is correct we need to use RCU accessors.
--- net/core/dev.c | 3 ++- net/core/netpoll.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
net/core/dev.c +2 -1
@@ -4849,13 +4849,14 @@ void netif_napi_add(struct net_device *dpr_err_once ("netif_napi_add() called with weight %d on device %s\n" , weight, dev->name); napi->weight = weight; -list_add (&napi->dev_list, &dev->napi_list); napi->dev = dev;#ifdef CONFIG_NETPOLL spin_lock_init (&napi->poll_lock); napi->poll_owner =-1 ;#endif set_bit (NAPI_STATE_SCHED , &napi->state); +set_bit (NAPI_STATE_NPSVC , &napi->state); +list_add_rcu (&napi->dev_list, &dev->napi_list); }EXPORT_SYMBOL (netif_napi_add);
net/core/netpoll.c +1 -1
@@ -178,7 +178,7 @@ static void poll_napi(struct net_device {struct napi_struct *napi; -list_for_each_entry (napi, &dev->napi_list, dev_list) { +list_for_each_entry_rcu (napi, &dev->napi_list, dev_list) {if (napi->poll_owner !=smp_processor_id () &&spin_trylock (&napi->poll_lock)) {poll_one_napi (napi);
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.236 release. There are 62 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 13 Sep 2020 12:24:42 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.236-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.4:
6 builds: 6 pass, 0 fail
12 boots: 12 pass, 0 fail
28 tests: 28 pass, 0 failLinux version: 4.4.236-rc1-g5a444641713b
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra30-cardhu-a04
Jon
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.236 release. There are 62 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 13 Sep 2020 12:24:42 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 10 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.236-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.236 release. There are 62 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 13 Sep 2020 12:24:42 +0000. Anything received after that time might be too late.
Build results:
total: 168 pass: 168 fail: 0 Qemu test results: total: 332 pass: 332 fail: 0
Guenter
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.236 release. There are 62 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 13 Sep 2020 12:24:42 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.236-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.4.236-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: 5a444641713b4fca895f5b30cf4b0d53dba5a383
git describe: v4.4.235-63-g5a444641713b
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.4.y/build/v4.4.235-63-g5a444641713b
No regressions (compared to build v4.4.235)
No fixes (compared to build v4.4.235)
Ran 8284 total tests in the following environments and test suites.
Environments
--------------
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* build
* kselftest
* kselftest/drivers
* kselftest/filesystems
* linux-log-parser
* network-basic-tests
* perf
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* v4l2-compliance
* ltp-syscalls-tests
* ltp-tracing-tests
* install-android-platform-tools-r2600
* kselftest/net
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-native/drivers
* kselftest-vsyscall-mode-native/filesystems
* kselftest-vsyscall-mode-none
* kselftest-vsyscall-mode-none/drivers
* kselftest-vsyscall-mode-none/filesystems
* ssuite
Summary
------------------------------------------------------------------------
kernel: 4.4.236-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git branch: 4.4.236-rc1-hikey-20200911-811
git commit: 9a083a8e28ba57575b8d73c5d5cf3529336e4240
git describe: 4.4.236-rc1-hikey-20200911-811
Test details: https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.236-rc1-hikey-20200911-811
No regressions (compared to build 4.4.236-rc1-hikey-20200908-809)
No fixes (compared to build 4.4.236-rc1-hikey-20200908-809)
Ran 1803 total tests in the following environments and test suites.
Environments
--------------
- hi6220-hikey - arm64
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* kselftest/drivers
* kselftest/filesystems
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org