4.4.211-stable review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 10/76 ALSA: line6: Fix memory leak at line6_init_pcm() error path
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 1bc8d18c75fef3b478dbdfef722aae09e2a9fde7 upstream.
I forgot to release the allocated object at the early error path in line6_init_pcm(). For addressing it, slightly shuffle the code so that the PCM destructor (pcm->private_free) is assigned properly before all error paths.
--- sound/usb/line6/pcm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
sound/usb/line6/pcm.c +9 -9
@@ -523,6 +523,15 @@ int line6_init_pcm(struct usb_line6 *lin line6pcm->volume_monitor =255 ; line6pcm->line6 = line6; +spin_lock_init (&line6pcm->out.lock); +spin_lock_init (&line6pcm->in.lock); + line6pcm->impulse_period =LINE6_IMPULSE_DEFAULT_PERIOD ; + + line6->line6pcm = line6pcm; + + pcm->private_data = line6pcm; + pcm->private_free = line6_cleanup_pcm; +/* Read and write buffers are sized identically, so choose minimum */ line6pcm->max_packet_size = min( usb_maxpacket(line6->usbdev,
@@ -535,15 +544,6 @@ int line6_init_pcm(struct usb_line6 *linreturn -EINVAL ; } -spin_lock_init (&line6pcm->out.lock); -spin_lock_init (&line6pcm->in.lock); - line6pcm->impulse_period =LINE6_IMPULSE_DEFAULT_PERIOD ; - - line6->line6pcm = line6pcm; - - pcm->private_data = line6pcm; - pcm->private_free = line6_cleanup_pcm; - err =line6_create_audio_out_urbs (line6pcm);if (err <0 )return err;
Greg Kroah-Hartman
maintainerPATCH 1/76 hidraw: Return EPOLLOUT from hidraw_poll
In reply to Greg Kroah-HartmanFrom: Fabian Henneke <[email protected]>
[ Upstream commit 378b80370aa1fe50f9c48a3ac8af3e416e73b89f ]
Always return EPOLLOUT from hidraw_poll when a device is connected. This is safe since writes are always possible (but will always block).
hidraw does not support non-blocking writes and instead always calls blocking backend functions on write requests. Hence, so far, a call to poll never returned EPOLLOUT, which confuses tools like socat.
In-reply-to: <CA+hv5qkyis03CgYTWeWX9cr0my-d2Oe+aZo+mjmWRXgjrGqyrw@mail.gmail.com>
--- drivers/hid/hidraw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hidraw.c +1 -1
@@ -265,7 +265,7 @@ static unsigned int hidraw_poll(struct file *file, poll_table *wait)poll_wait (file, &list->hidraw->wait, wait);if (list->head != list->tail) -return POLLIN |POLLRDNORM ; +return POLLIN |POLLRDNORM |POLLOUT ;if (!list->hidraw->exist)return POLLERR |POLLHUP ;return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 11/76 mm/page_alloc.c: calculate available memory in a separate function
In reply to Greg Kroah-HartmanFrom: Igor Redko <[email protected]>
commit d02bd27bd33dd7e8d22594cd568b81be0cb584cd upstream.
Add a new field, VIRTIO_BALLOON_S_AVAIL, to virtio_balloon memory statistics protocol, corresponding to 'Available' in /proc/meminfo.
It indicates to the hypervisor how big the balloon can be inflated without pushing the guest system to swap. This metric would be very useful in VM orchestration software to improve memory management of different VMs under overcommit.
This patch (of 2):
Factor out calculation of the available memory counter into a separate exportable function, in order to be able to use it in other parts of the kernel.
In particular, it appears a relevant metric to report to the hypervisor via virtio-balloon statistics interface (in a followup patch).
[bwh: Backported to 4.4 as dependency of commit a1078e821b60
"xen: let alloc_xenballooned_pages() fail if not enough memory free"]
--- fs/proc/meminfo.c | 31 +------------------------------ include/linux/mm.h | 1 + mm/page_alloc.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 30 deletions(-)
fs/proc/meminfo.c +1 -30
@@ -29,10 +29,7 @@ static int meminfo_proc_show(struct seq_unsigned long committed;long cached;long available; -unsigned long pagecache; -unsigned long wmark_low =0 ;unsigned long pages[NR_LRU_LISTS ]; -struct zone *zone;int lru;/*
@@ -51,33 +48,7 @@ static int meminfo_proc_show(struct seq_for (lru =LRU_BASE ; lru <NR_LRU_LISTS ; lru++) pages[lru] =global_page_state (NR_LRU_BASE + lru); -for_each_zone (zone) - wmark_low += zone->watermark[WMARK_LOW ]; - -/* -* Estimate the amount of memory available for userspace allocations, -* without causing swapping. -*/ - available = i.freeram - totalreserve_pages; - -/* -* Not all the page cache can be freed, otherwise the system will -* start swapping. Assume at least half of the page cache, or the -* low watermark worth of cache, needs to stay. -*/ - pagecache = pages[LRU_ACTIVE_FILE ] + pages[LRU_INACTIVE_FILE ]; - pagecache -=min (pagecache /2 , wmark_low); - available += pagecache; - -/* -* Part of the reclaimable slab consists of items that are in use, -* and cannot be freed. Cap this estimate at the low watermark. -*/ - available +=global_page_state (NR_SLAB_RECLAIMABLE ) - -min (global_page_state (NR_SLAB_RECLAIMABLE ) /2 , wmark_low); - -if (available <0 ) - available =0 ; + available =si_mem_available ();/* * Tagged format, for easy grepping and expansion.
include/linux/mm.h +1 -0
@@ -1802,6 +1802,7 @@ extern int __meminit init_per_zone_wmarkextern void mem_init (void );extern void __init mmap_init (void );extern void show_mem (unsigned int flags); +extern long si_mem_available (void );extern void si_meminfo (struct sysinfo * val);extern void si_meminfo_node (struct sysinfo *val,int nid);
mm/page_alloc.c +43 -0
49 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 12/76 xen: let alloc_xenballooned_pages() fail if not enough memory free
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit a1078e821b605813b63bf6bca414a85f804d5c66 upstream.
Instead of trying to allocate pages with GFP_USER in add_ballooned_pages() check the available free memory via si_mem_available(). GFP_USER is far less limiting memory exhaustion than the test via si_mem_available().
This will avoid dom0 running out of memory due to excessive foreign page mappings especially on ARM and on x86 in PVH mode, as those don't have a pre-ballooned area which can be used for foreign mappings.
As the normal ballooning suffers from the same problem don't balloon down more than si_mem_available() pages in one iteration. At the same time limit the default maximum number of retries.
This is part of XSA-300.
--- drivers/xen/balloon.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/xen/balloon.c +13 -3
@@ -584,8 +584,15 @@ static void balloon_process(struct work_ state =reserve_additional_memory (); } -if (credit <0 ) - state =decrease_reservation (-credit,GFP_BALLOON ); +if (credit <0 ) { +long n_pages; + + n_pages =min (-credit,si_mem_available ()); + state =decrease_reservation (n_pages,GFP_BALLOON ); +if (state ==BP_DONE && n_pages != -credit && + n_pages < totalreserve_pages) + state =BP_EAGAIN ; + } state =update_schedule (state);
@@ -624,6 +631,9 @@ static int add_ballooned_pages(int nr_pa } } +if (si_mem_available () < nr_pages) +return -ENOMEM ; + st =decrease_reservation (nr_pages,GFP_USER );if (st !=BP_DONE )return -ENOMEM ;
@@ -747,7 +757,7 @@ static int __init balloon_init(void) balloon_stats.schedule_delay =1 ; balloon_stats.max_schedule_delay =32 ; balloon_stats.retry_count =1 ; - balloon_stats.max_retry_count =RETRY_UNLIMITED ; + balloon_stats.max_retry_count =4 ;#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG set_online_page_callback (&xen_online_page);
Greg Kroah-Hartman
maintainerPATCH 13/76 wimax: i2400: fix memory leak
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit 2507e6ab7a9a440773be476141a255934468c5ef upstream.
In i2400m_op_rfkill_sw_toggle cmd buffer should be released along with skb response.
--- drivers/net/wimax/i2400m/op-rfkill.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wimax/i2400m/op-rfkill.c +1 -0
@@ -142,6 +142,7 @@ int i2400m_op_rfkill_sw_toggle(struct wi "%d\n", result); result =0 ; error_cmd: +kfree (cmd);kfree_skb (ack_skb); error_msg_to_dev: error_alloc:
Greg Kroah-Hartman
maintainerPATCH 15/76 ext4: fix use-after-free race with debug_want_extra_isize
In reply to Greg Kroah-HartmanFrom: Barret Rhoden <[email protected]>
commit 7bc04c5c2cc467c5b40f2b03ba08da174a0d5fa7 upstream.
When remounting with debug_want_extra_isize, we were not performing the same checks that we do during a normal mount. That allowed us to set a value for s_want_extra_isize that reached outside the s_inode_size.
[bwh: Backported to 4.4: The debug_want_extra_isize mount option is not
supported]
--- fs/ext4/super.c | 56 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 23 deletions(-)
fs/ext4/super.c +33 -23
@@ -3169,6 +3169,36 @@ int ext4_calculate_overhead(struct superreturn 0 ; } +static void ext4_clamp_want_extra_isize (struct super_block *sb) +{ +struct ext4_sb_info *sbi =EXT4_SB (sb); +struct ext4_super_block *es = sbi->s_es; + +/* determine the minimum size of new large inodes, if present */ +if (sbi->s_inode_size >EXT4_GOOD_OLD_INODE_SIZE ) { + sbi->s_want_extra_isize =sizeof (struct ext4_inode ) - +EXT4_GOOD_OLD_INODE_SIZE ; +if (ext4_has_feature_extra_isize (sb)) { +if (sbi->s_want_extra_isize < +le16_to_cpu (es->s_want_extra_isize)) + sbi->s_want_extra_isize = +le16_to_cpu (es->s_want_extra_isize); +if (sbi->s_want_extra_isize < +le16_to_cpu (es->s_min_extra_isize)) + sbi->s_want_extra_isize = +le16_to_cpu (es->s_min_extra_isize); + } + } +/* Check if enough inode space is available */ +if (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > + sbi->s_inode_size) { + sbi->s_want_extra_isize =sizeof (struct ext4_inode ) - +EXT4_GOOD_OLD_INODE_SIZE ; +ext4_msg (sb,KERN_INFO , +"required extra inode space not available" ); + } +} +static void ext4_set_resv_clusters (struct super_block *sb) {ext4_fsblk_t resv_clusters;
@@ -3991,29 +4021,7 @@ no_journal:if (ext4_setup_super (sb, es, sb->s_flags &MS_RDONLY )) sb->s_flags |=MS_RDONLY ; -/* determine the minimum size of new large inodes, if present */ -if (sbi->s_inode_size >EXT4_GOOD_OLD_INODE_SIZE ) { - sbi->s_want_extra_isize =sizeof (struct ext4_inode ) - -EXT4_GOOD_OLD_INODE_SIZE ; -if (ext4_has_feature_extra_isize (sb)) { -if (sbi->s_want_extra_isize < -le16_to_cpu (es->s_want_extra_isize)) - sbi->s_want_extra_isize = -le16_to_cpu (es->s_want_extra_isize); -if (sbi->s_want_extra_isize < -le16_to_cpu (es->s_min_extra_isize)) - sbi->s_want_extra_isize = -le16_to_cpu (es->s_min_extra_isize); - } - } -/* Check if enough inode space is available */ -if (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > - sbi->s_inode_size) { - sbi->s_want_extra_isize =sizeof (struct ext4_inode ) - -EXT4_GOOD_OLD_INODE_SIZE ; -ext4_msg (sb,KERN_INFO ,"required extra inode space not" -"available" ); - } +ext4_clamp_want_extra_isize (sb);ext4_set_resv_clusters (sb);
@@ -4766,6 +4774,8 @@ static int ext4_remount(struct super_blo goto restore_opts; } +ext4_clamp_want_extra_isize (sb); +if ((old_opts.s_mount_opt &EXT4_MOUNT_JOURNAL_CHECKSUM ) ^test_opt (sb,JOURNAL_CHECKSUM )) { ext4_msg(sb, KERN_ERR, "changing journal_checksum "
Greg Kroah-Hartman
maintainerPATCH 16/76 ext4: add more paranoia checking in ext4_expand_extra_isize handling
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 4ea99936a1630f51fc3a2d61a58ec4a1c4b7d55a upstream.
It's possible to specify a non-zero s_want_extra_isize via debugging option, and this can cause bad things(tm) to happen when using a file system with an inode size of 128 bytes.
Add better checking when the file system is mounted, as well as when we are actually doing the trying to do the inode expansion.
--- fs/ext4/inode.c | 15 +++++++++++++++ fs/ext4/super.c | 20 ++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-)
fs/ext4/inode.c +15 -0
@@ -5189,10 +5189,25 @@ static int ext4_expand_extra_isize(struc {struct ext4_inode *raw_inode;struct ext4_xattr_ibody_header *header; +unsigned int inode_size =EXT4_INODE_SIZE (inode->i_sb); +struct ext4_inode_info *ei =EXT4_I (inode);if (EXT4_I (inode)->i_extra_isize >= new_extra_isize)return 0 ; +/* this was checked at iget time, but double check for good measure */ +if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) || + (ei->i_extra_isize &3 )) { +EXT4_ERROR_INODE (inode,"bad extra_isize %u (inode size %u)" , + ei->i_extra_isize, +EXT4_INODE_SIZE (inode->i_sb)); +return -EFSCORRUPTED ; + } +if ((new_extra_isize < ei->i_extra_isize) || + (new_extra_isize <4 ) || + (new_extra_isize > inode_size -EXT4_GOOD_OLD_INODE_SIZE )) +return -EINVAL ;/* Should never happen */ + raw_inode =ext4_raw_inode (&iloc); header =IHDR (inode, raw_inode);
fs/ext4/super.c +12 -8
@@ -3173,11 +3173,15 @@ static void ext4_clamp_want_extra_isize( {struct ext4_sb_info *sbi =EXT4_SB (sb);struct ext4_super_block *es = sbi->s_es; +unsigned def_extra_isize =sizeof (struct ext4_inode ) - +EXT4_GOOD_OLD_INODE_SIZE ; -/* determine the minimum size of new large inodes, if present */ -if (sbi->s_inode_size >EXT4_GOOD_OLD_INODE_SIZE ) { - sbi->s_want_extra_isize =sizeof (struct ext4_inode ) - -EXT4_GOOD_OLD_INODE_SIZE ; +if (sbi->s_inode_size ==EXT4_GOOD_OLD_INODE_SIZE ) { + sbi->s_want_extra_isize =0 ; +return ; + } +if (sbi->s_want_extra_isize <4 ) { + sbi->s_want_extra_isize = def_extra_isize;if (ext4_has_feature_extra_isize (sb)) {if (sbi->s_want_extra_isize <le16_to_cpu (es->s_want_extra_isize))
@@ -3190,10 +3194,10 @@ static void ext4_clamp_want_extra_isize( } }/* Check if enough inode space is available */ -if (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > - sbi->s_inode_size) { - sbi->s_want_extra_isize =sizeof (struct ext4_inode ) - -EXT4_GOOD_OLD_INODE_SIZE ; +if ((sbi->s_want_extra_isize > sbi->s_inode_size) || + (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > + sbi->s_inode_size)) { + sbi->s_want_extra_isize = def_extra_isize;ext4_msg (sb,KERN_INFO ,"required extra inode space not available" ); }
Greg Kroah-Hartman
maintainerPATCH 17/76 dccp: Fix memleak in __feat_register_sp
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit 1d3ff0950e2b40dc861b1739029649d03f591820 upstream.
If dccp_feat_push_change fails, we forget free the mem which is alloced by kmemdup in dccp_feat_clone_sp_val.
--- net/dccp/feat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/dccp/feat.c +6 -1
@@ -738,7 +738,12 @@ static int __feat_register_sp(struct lisif (dccp_feat_clone_sp_val (&fval, sp_val, sp_len))return -ENOMEM ; -return dccp_feat_push_change (fn, feat, is_local, mandatory, &fval); +if (dccp_feat_push_change (fn, feat, is_local, mandatory, &fval)) { +kfree (fval.sp.vec); +return -ENOMEM ; + } + +return 0 ; }/**
Greg Kroah-Hartman
maintainerPATCH 18/76 rtc: mt6397: fix alarm register overwrite
In reply to Greg Kroah-HartmanFrom: Ran Bi <[email protected]>
commit 653997eeecef95c3ead4fba1b2d27e6a5854d6cd upstream.
Alarm registers high byte was reserved for other functions. This add mask in alarm registers operation functions. This also fix error condition in interrupt handler.
--- drivers/rtc/rtc-mt6397.c | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-)
drivers/rtc/rtc-mt6397.c +33 -14
@@ -55,6 +55,14 @@#define RTC_AL_SEC 0x0018 +#define RTC_AL_SEC_MASK 0x003f +#define RTC_AL_MIN_MASK 0x003f +#define RTC_AL_HOU_MASK 0x001f +#define RTC_AL_DOM_MASK 0x001f +#define RTC_AL_DOW_MASK 0x0007 +#define RTC_AL_MTH_MASK 0x000f +#define RTC_AL_YEA_MASK 0x007f +#define RTC_PDN2 0x002e#define RTC_PDN2_PWRON_ALARM BIT(4)
@@ -111,7 +119,7 @@ static irqreturn_t mtk_rtc_irq_handler_t irqen = irqsta & ~RTC_IRQ_EN_AL ;mutex_lock (&rtc->lock);if (regmap_write (rtc->regmap, rtc->addr_base +RTC_IRQ_EN , - irqen) <0 ) + irqen) ==0 )mtk_rtc_write_trigger (rtc);mutex_unlock (&rtc->lock);
@@ -233,12 +241,12 @@ static int mtk_rtc_read_alarm(struct dev alm->pending = !!(pdn2 &RTC_PDN2_PWRON_ALARM );mutex_unlock (&rtc->lock); - tm->tm_sec = data[RTC_OFFSET_SEC ]; - tm->tm_min = data[RTC_OFFSET_MIN ]; - tm->tm_hour = data[RTC_OFFSET_HOUR ]; - tm->tm_mday = data[RTC_OFFSET_DOM ]; - tm->tm_mon = data[RTC_OFFSET_MTH ]; - tm->tm_year = data[RTC_OFFSET_YEAR ]; + tm->tm_sec = data[RTC_OFFSET_SEC ] &RTC_AL_SEC_MASK ; + tm->tm_min = data[RTC_OFFSET_MIN ] &RTC_AL_MIN_MASK ; + tm->tm_hour = data[RTC_OFFSET_HOUR ] &RTC_AL_HOU_MASK ; + tm->tm_mday = data[RTC_OFFSET_DOM ] &RTC_AL_DOM_MASK ; + tm->tm_mon = data[RTC_OFFSET_MTH ] &RTC_AL_MTH_MASK ; + tm->tm_year = data[RTC_OFFSET_YEAR ] &RTC_AL_YEA_MASK ; tm->tm_year +=RTC_MIN_YEAR_OFFSET ; tm->tm_mon--;
@@ -259,14 +267,25 @@ static int mtk_rtc_set_alarm(struct devi tm->tm_year -=RTC_MIN_YEAR_OFFSET ; tm->tm_mon++; - data[RTC_OFFSET_SEC ] = tm->tm_sec; - data[RTC_OFFSET_MIN ] = tm->tm_min; - data[RTC_OFFSET_HOUR ] = tm->tm_hour; - data[RTC_OFFSET_DOM ] = tm->tm_mday; - data[RTC_OFFSET_MTH ] = tm->tm_mon; - data[RTC_OFFSET_YEAR ] = tm->tm_year; -mutex_lock (&rtc->lock); + ret =regmap_bulk_read (rtc->regmap, rtc->addr_base +RTC_AL_SEC , + data,RTC_OFFSET_COUNT ); +if (ret <0 ) + goto exit; + + data[RTC_OFFSET_SEC ] = ((data[RTC_OFFSET_SEC ] & ~(RTC_AL_SEC_MASK )) | + (tm->tm_sec &RTC_AL_SEC_MASK )); + data[RTC_OFFSET_MIN ] = ((data[RTC_OFFSET_MIN ] & ~(RTC_AL_MIN_MASK )) | + (tm->tm_min &RTC_AL_MIN_MASK )); + data[RTC_OFFSET_HOUR ] = ((data[RTC_OFFSET_HOUR ] & ~(RTC_AL_HOU_MASK )) | + (tm->tm_hour &RTC_AL_HOU_MASK )); + data[RTC_OFFSET_DOM ] = ((data[RTC_OFFSET_DOM ] & ~(RTC_AL_DOM_MASK )) | + (tm->tm_mday &RTC_AL_DOM_MASK )); + data[RTC_OFFSET_MTH ] = ((data[RTC_OFFSET_MTH ] & ~(RTC_AL_MTH_MASK )) | + (tm->tm_mon &RTC_AL_MTH_MASK )); + data[RTC_OFFSET_YEAR ] = ((data[RTC_OFFSET_YEAR ] & ~(RTC_AL_YEA_MASK )) | + (tm->tm_year &RTC_AL_YEA_MASK )); +if (alm->enabled) { ret = regmap_bulk_write(rtc->regmap, rtc->addr_base + RTC_AL_SEC,
Greg Kroah-Hartman
maintainerPATCH 2/76 HID: hidraw: Fix returning EPOLLOUT from hidraw_poll
In reply to Greg Kroah-HartmanFrom: Marcel Holtmann <[email protected]>
[ Upstream commit 9f3b61dc1dd7b81e99e7ed23776bb64a35f39e1a ]
When polling a connected /dev/hidrawX device, it is useful to get the EPOLLOUT when writing is possible. Since writing is possible as soon as the device is connected, always return it.
Right now EPOLLOUT is only returned when there are also input reports are available. This works if devices start sending reports when connected, but some HID devices might need an output report first before sending any input reports. This change will allow using EPOLLOUT here as well.
--- drivers/hid/hidraw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hidraw.c +2 -2
@@ -265,10 +265,10 @@ static unsigned int hidraw_poll(struct file *file, poll_table *wait)poll_wait (file, &list->hidraw->wait, wait);if (list->head != list->tail) -return POLLIN |POLLRDNORM |POLLOUT ; +return POLLIN |POLLRDNORM ;if (!list->hidraw->exist)return POLLERR |POLLHUP ; -return 0 ; +return POLLOUT |POLLWRNORM ; }static int hidraw_open (struct inode *inode,struct file *file)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 21/76 hsr: reset network header when supervision frame is created
In reply to Greg Kroah-HartmanFrom: Taehee Yoo <[email protected]>
commit 3ed0a1d563903bdb4b4c36c58c4d9c1bcb23a6e6 upstream.
The supervision frame is L2 frame.
When supervision frame is created, hsr module doesn't set network header. If tap routine is enabled, dev_queue_xmit_nit() is called and it checks network_header. If network_header pointer wasn't set(or invalid), it resets network_header and warns.
In order to avoid unnecessary warning message, resetting network_header is needed.
Test commands:
ip netns add nst
ip link add veth0 type veth peer name veth1
ip link add veth2 type veth peer name veth3
ip link set veth1 netns nst
ip link set veth3 netns nst
ip link set veth0 up
ip link set veth2 up
ip link add hsr0 type hsr slave1 veth0 slave2 veth2
ip a a 192.168.100.1/24 dev hsr0
ip link set hsr0 up
ip netns exec nst ip link set veth1 up
ip netns exec nst ip link set veth3 up
ip netns exec nst ip link add hsr1 type hsr slave1 veth1 slave2 veth3 ip netns exec nst ip a a 192.168.100.2/24 dev hsr1
ip netns exec nst ip link set hsr1 up
tcpdump -nei veth0
Splat looks like:
[ 175.852292][ C3] protocol 88fb is buggy, dev veth0
--- net/hsr/hsr_device.c | 2 ++ 1 file changed, 2 insertions(+)
net/hsr/hsr_device.c +2 -0
@@ -289,6 +289,8 @@ static void send_hsr_supervision_frame(s skb->dev->dev_addr, skb->len) <= 0) goto out;skb_reset_mac_header (skb); +skb_reset_network_header (skb); +skb_reset_transport_header (skb); hsr_stag = (typeof (hsr_stag ))skb_put (skb,sizeof (*hsr_stag));
Greg Kroah-Hartman
maintainerPATCH 20/76 gpio: Fix error message on out-of-range GPIO in lookup table
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
commit d935bd50dd14a7714cbdba9a76435dbb56edb1ae upstream.
When a GPIO offset in a lookup table is out-of-range, the printed error message (1) does not include the actual out-of-range value, and (2) contains an off-by-one error in the upper bound.
Avoid user confusion by also printing the actual GPIO offset, and correcting the upper bound of the range.
While at it, use "%u" for unsigned int.
Sample impact:
-requested GPIO 0 is out of range [0..32] for chip e6052000.gpio
+requested GPIO 0 (45) is out of range [0..31] for chip e6052000.gpio--- drivers/gpio/gpiolib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib.c +3 -2
@@ -1949,8 +1949,9 @@ static struct gpio_desc *gpiod_find(struif (chip->ngpio <= p->chip_hwnum) {dev_err (dev, -"requested GPIO %d is out of range [0..%d] for chip %s\n" , - idx, chip->ngpio, chip->label); +"requested GPIO %u (%u) is out of range [0..%u] for chip %s\n" , + idx, p->chip_hwnum, chip->ngpio -1 , + chip->label);return ERR_PTR (-EINVAL ); }
Greg Kroah-Hartman
maintainerPATCH 22/76 cifs: Adjust indentation in smb2_open_file
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 7935799e041ae10d380d04ea23868240f082bd11 upstream.
Clang warns:
../fs/cifs/smb2file.c:70:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
if (oparms->tcon->use_resilient) {
^
../fs/cifs/smb2file.c:66:2: note: previous statement is here
if (rc)
^1 warning generated.
This warning occurs because there is a space after the tab on this line. Remove it so that the indentation is consistent with the Linux kernel coding style and clang no longer warns.
--- fs/cifs/smb2file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2file.c +1 -1
@@ -69,7 +69,7 @@ smb2_open_file(const unsigned int xid, s goto out; -if (oparms->tcon->use_resilient) { +if (oparms->tcon->use_resilient) { nr_ioctl_req.Timeout =0 ;/* use server default (120 seconds) */ nr_ioctl_req.Reserved =0 ; rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid,
Greg Kroah-Hartman
maintainerPATCH 23/76 RDMA/srpt: Report the SCSI residual to the initiator
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
commit e88982ad1bb12db699de96fbc07096359ef6176c upstream.
The code added by this patch is similar to the code that already exists in ibmvscsis_determine_resid(). This patch has been tested by running the following command:
strace sg_raw -r 1k /dev/sdb 12 00 00 00 60 00 -o inquiry.bin |&
grep resid=
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/infiniband/ulp/srpt/ib_srpt.c +24 -0
@@ -1513,9 +1513,11 @@ static int srpt_build_cmd_rsp(struct srp struct srpt_send_ioctx *ioctx, u64 tag, int status) { + struct se_cmd *cmd = &ioctx->cmd;struct srp_rsp *srp_rsp;const u8 *sense_data;int sense_data_len, max_sense_len; +u32 resid = cmd->residual_count;/* * The lowest bit of all SAM-3 status codes is zero (see also
@@ -1537,6 +1539,28 @@ static int srpt_build_cmd_rsp(struct srp srp_rsp->tag = tag; srp_rsp->status = status; +if (cmd->se_cmd_flags &SCF_UNDERFLOW_BIT ) { +if (cmd->data_direction ==DMA_TO_DEVICE ) { +/* residual data from an underflow write */ + srp_rsp->flags =SRP_RSP_FLAG_DOUNDER ; + srp_rsp->data_out_res_cnt =cpu_to_be32 (resid); + }else if (cmd->data_direction ==DMA_FROM_DEVICE ) { +/* residual data from an underflow read */ + srp_rsp->flags =SRP_RSP_FLAG_DIUNDER ; + srp_rsp->data_in_res_cnt =cpu_to_be32 (resid); + } + }else if (cmd->se_cmd_flags &SCF_OVERFLOW_BIT ) { +if (cmd->data_direction ==DMA_TO_DEVICE ) { +/* residual data from an overflow write */ + srp_rsp->flags =SRP_RSP_FLAG_DOOVER ; + srp_rsp->data_out_res_cnt =cpu_to_be32 (resid); + }else if (cmd->data_direction ==DMA_FROM_DEVICE ) { +/* residual data from an overflow read */ + srp_rsp->flags =SRP_RSP_FLAG_DIOVER ; + srp_rsp->data_in_res_cnt =cpu_to_be32 (resid); + } + } +if (sense_data_len) {BUILD_BUG_ON (MIN_MAX_RSP_SIZE <=sizeof (*srp_rsp)); max_sense_len = ch->max_ti_iu_len -sizeof (*srp_rsp);
Greg Kroah-Hartman
maintainerPATCH 25/76 scsi: sd: Clear sdkp->protection_type if disk is reformatted without PI
In reply to Greg Kroah-HartmanFrom: Xiang Chen <[email protected]>
commit 465f4edaecc6c37f81349233e84d46246bcac11a upstream.
If an attached disk with protection information enabled is reformatted to Type 0 the revalidation code does not clear the original protection type and subsequent accesses will keep setting RDPROTECT/WRPROTECT.
Set the protection type to 0 if the disk reports PROT_EN=0 in READ CAPACITY(16).
[mkp: commit desc]
--- drivers/scsi/sd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/sd.c +3 -1
@@ -1998,8 +1998,10 @@ static int sd_read_protection_type(strucu8 type;int ret =0 ; -if (scsi_device_protection (sdp) ==0 || (buffer[12 ] &1 ) ==0 ) +if (scsi_device_protection (sdp) ==0 || (buffer[12 ] &1 ) ==0 ) { + sdkp->protection_type =0 ;return ret; + } type = ((buffer[12 ] >>1 ) &7 ) +1 ;/* P_TYPE 0 = Type 1 */
Greg Kroah-Hartman
maintainerPATCH 26/76 platform/x86: asus-wmi: Fix keyboard brightness cannot be set to 0
In reply to Greg Kroah-HartmanFrom: Jian-Hong Pan <[email protected]>
commit 176a7fca81c5090a7240664e3002c106d296bf31 upstream.
Some of ASUS laptops like UX431FL keyboard backlight cannot be set to brightness 0. According to ASUS' information, the brightness should be 0x80 ~ 0x83. This patch fixes it by following the logic.
--- drivers/platform/x86/asus-wmi.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/platform/x86/asus-wmi.c +1 -7
@@ -452,13 +452,7 @@ static void kbd_led_update(struct work_s asus = container_of(work, struct asus_wmi, kbd_led_work); -/* -* bits 0-2: level -* bit 7: light on/off -*/ -if (asus->kbd_led_wk >0 ) - ctrl_param =0x80 | (asus->kbd_led_wk &0x7F ); - + ctrl_param =0x80 | (asus->kbd_led_wk &0x7F );asus_wmi_set_devstate (ASUS_WMI_DEVID_KBD_BACKLIGHT , ctrl_param,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 29/76 clk: samsung: exynos5420: Preserve CPU clocks configuration during suspend/resume
In reply to Greg Kroah-HartmanFrom: Marian Mihailescu <[email protected]>
commit e21be0d1d7bd7f78a77613f6bcb6965e72b22fc1 upstream.
Save and restore top PLL related configuration registers for big (APLL) and LITTLE (KPLL) cores during suspend/resume cycle. So far, CPU clocks were reset to default values after suspend/resume cycle and performance after system resume was affected when performance governor has been selected.
--- drivers/clk/samsung/clk-exynos5420.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/samsung/clk-exynos5420.c +2 -0
@@ -166,6 +166,8 @@ static unsigned long exynos5x_clk_regs[]GATE_BUS_CPU ,GATE_SCLK_CPU ,CLKOUT_CMU_CPU , +APLL_CON0 , +KPLL_CON0 ,CPLL_CON0 ,DPLL_CON0 , EPLL_CON0,
Greg Kroah-Hartman
maintainerPATCH 3/76 HID: hidraw, uhid: Always report EPOLLOUT
In reply to Greg Kroah-HartmanFrom: Jiri Kosina <[email protected]>
[ Upstream commit 9e635c2851df6caee651e589fbf937b637973c91 ]
hidraw and uhid device nodes are always available for writing so we should always report EPOLLOUT and EPOLLWRNORM bits, not only in the cases when there is nothing to read.
--- drivers/hid/hidraw.c | 7 ++++--- drivers/hid/uhid.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/hid/hidraw.c +4 -3
@@ -262,13 +262,14 @@ out:static unsigned int hidraw_poll (struct file *file,poll_table *wait) {struct hidraw_list *list = file->private_data; +unsigned int mask =POLLOUT |POLLWRNORM ;/* hidraw is always writable */ poll_wait (file, &list->hidraw->wait, wait);if (list->head != list->tail) -return POLLIN |POLLRDNORM ; + mask |=POLLIN |POLLRDNORM ;if (!list->hidraw->exist) -return POLLERR |POLLHUP ; -return POLLOUT |POLLWRNORM ; + mask |=POLLERR |POLLHUP ; +return mask; }static int hidraw_open (struct inode *inode,struct file *file)
drivers/hid/uhid.c +3 -2
@@ -769,13 +769,14 @@ unlock:static unsigned int uhid_char_poll (struct file *file,poll_table *wait) {struct uhid_device *uhid = file->private_data; +unsigned int mask =POLLOUT |POLLWRNORM ;/* uhid is always writable */ poll_wait (file, &uhid->waitq, wait);if (uhid->head != uhid->tail) -return POLLIN |POLLRDNORM ; + mask |=POLLIN |POLLRDNORM ; -return EPOLLOUT |EPOLLWRNORM ; +return mask; }static const struct file_operations uhid_fops = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 4/76 rsi: add fix for crash during assertions
In reply to Greg Kroah-HartmanFrom: Sanjay Konduri <[email protected]>
commit abd39c6ded9db53aa44c2540092bdd5fb6590fa8 upstream.
Observed crash in some scenarios when assertion has occurred, this is because hw structure is freed and is tried to get accessed in some functions where null check is already present. So, avoided the crash by making the hw to NULL after freeing.
--- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/rsi/rsi_91x_mac80211.c +1 -0
@@ -199,6 +199,7 @@ void rsi_mac80211_detach(struct rsi_hw *ieee80211_stop_queues (hw);ieee80211_unregister_hw (hw);ieee80211_free_hw (hw); + adapter->hw =NULL ; }rsi_remove_dbgfs (adapter);
Greg Kroah-Hartman
maintainerPATCH 5/76 cfg80211/mac80211: make ieee80211_send_layer2_update a public function
In reply to Greg Kroah-HartmanFrom: Dedy Lansky <[email protected]>
commit 30ca1aa536211f5ac3de0173513a7a99a98a97f3 upstream.
Make ieee80211_send_layer2_update() a common function so other drivers can re-use it.
[bwh: Backported to 4.4 as dependency of commit 3e493173b784
"mac80211: Do not send Layer 2 Update frame before authorization":
- Retain type-casting of skb_put() return value
- Adjust context]
--- include/net/cfg80211.h | 11 +++++++++++ net/mac80211/cfg.c | 48 ++---------------------------------------------- net/wireless/util.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 46 deletions(-)
include/net/cfg80211.h +11 -0
@@ -3856,6 +3856,17 @@ const u8 *cfg80211_find_vendor_ie(unsign const u8 *ies, int len);/** +* cfg80211_send_layer2_update - send layer 2 update frame +* +* @dev: network device +* @addr: STA MAC address +* +* Wireless drivers can use this function to update forwarding tables in bridge +* devices upon STA association. +*/ +void cfg80211_send_layer2_update (struct net_device *dev,const u8 *addr); + +/** * DOC: Regulatory enforcement infrastructure * * TODO
net/mac80211/cfg.c +2 -46
66 lines not on this page · raw message
net/wireless/util.c +45 -0
48 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 6/76 mac80211: Do not send Layer 2 Update frame before authorization
In reply to Greg Kroah-HartmanFrom: Jouni Malinen <[email protected]>
commit 3e493173b7841259a08c5c8e5cbe90adb349da7e upstream.
The Layer 2 Update frame is used to update bridges when a station roams to another AP even if that STA does not transmit any frames after the reassociation. This behavior was described in IEEE Std 802.11F-2003 as something that would happen based on MLME-ASSOCIATE.indication, i.e., before completing 4-way handshake. However, this IEEE trial-use recommended practice document was published before RSN (IEEE Std 802.11i-2004) and as such, did not consider RSN use cases. Furthermore, IEEE Std 802.11F-2003 was withdrawn in 2006 and as such, has not been maintained amd should not be used anymore.
Sending out the Layer 2 Update frame immediately after association is fine for open networks (and also when using SAE, FT protocol, or FILS authentication when the station is actually authenticated by the time association completes). However, it is not appropriate for cases where RSN is used with PSK or EAP authentication since the station is actually fully authenticated only once the 4-way handshake completes after authentication and attackers might be able to use the unauthenticated triggering of Layer 2 Update frame transmission to disrupt bridge behavior.
Fix this by postponing transmission of the Layer 2 Update frame from station entry addition to the point when the station entry is marked authorized. Similarly, send out the VLAN binding update only if the STA entry has already been authorized.
--- net/mac80211/cfg.c | 11 +++-------- net/mac80211/sta_info.c | 4 ++++ 2 files changed, 7 insertions(+), 8 deletions(-)
net/mac80211/cfg.c +3 -8
@@ -1150,7 +1150,6 @@ static int ieee80211_add_station(structstruct sta_info *sta;struct ieee80211_sub_if_data *sdata;int err; -int layer2_update;if (params->vlan) { sdata =IEEE80211_DEV_TO_SUB_IF (params->vlan);
@@ -1204,18 +1203,12 @@ static int ieee80211_add_station(struct test_sta_flag(sta, WLAN_STA_ASSOC))rate_control_rate_init (sta); - layer2_update = sdata->vif.type ==NL80211_IFTYPE_AP_VLAN || - sdata->vif.type ==NL80211_IFTYPE_AP ; - err =sta_info_insert_rcu (sta);if (err) {rcu_read_unlock ();return err; } -if (layer2_update) -cfg80211_send_layer2_update (sta->sdata->dev, sta->sta.addr); -rcu_read_unlock ();return 0 ;
@@ -1323,7 +1316,9 @@ static int ieee80211_change_station(struatomic_inc (&sta->sdata->bss->num_mcast_sta); } -cfg80211_send_layer2_update (sta->sdata->dev, sta->sta.addr); +if (sta->sta_state ==IEEE80211_STA_AUTHORIZED ) +cfg80211_send_layer2_update (sta->sdata->dev, + sta->sta.addr); } err =sta_apply_parameters (local, sta, params);
net/mac80211/sta_info.c +4 -0
@@ -1775,6 +1775,10 @@ int sta_info_move_state(struct sta_infoset_bit (WLAN_STA_AUTHORIZED , &sta->_flags);ieee80211_check_fast_xmit (sta); } +if (sta->sdata->vif.type ==NL80211_IFTYPE_AP_VLAN || + sta->sdata->vif.type ==NL80211_IFTYPE_AP ) +cfg80211_send_layer2_update (sta->sdata->dev, + sta->sta.addr);break ;default :break ;
Greg Kroah-Hartman
maintainerPATCH 7/76 media: usb:zr364xx:Fix KASAN:null-ptr-deref Read in zr364xx_vidioc_querycap
In reply to Greg Kroah-HartmanFrom: Vandana BN <[email protected]>
commit 5d2e73a5f80a5b5aff3caf1ec6d39b5b3f54b26e upstream.
SyzKaller hit the null pointer deref while reading from uninitialized udev->product in zr364xx_vidioc_querycap().
==================================================================
BUG: KASAN: null-ptr-deref in read_word_at_a_time+0xe/0x20 include/linux/compiler.h:274 Read of size 1 at addr 0000000000000000 by task v4l_id/5287 CPU: 1 PID: 5287 Comm: v4l_id Not tainted 5.1.0-rc3-319004-g43151d6 #6 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xe8/0x16e lib/dump_stack.c:113 kasan_report.cold+0x5/0x3c mm/kasan/report.c:321 read_word_at_a_time+0xe/0x20 include/linux/compiler.h:274 strscpy+0x8a/0x280 lib/string.c:207 zr364xx_vidioc_querycap+0xb5/0x210 drivers/media/usb/zr364xx/zr364xx.c:706 v4l_querycap+0x12b/0x340 drivers/media/v4l2-core/v4l2-ioctl.c:1062 __video_do_ioctl+0x5bb/0xb40 drivers/media/v4l2-core/v4l2-ioctl.c:2874 video_usercopy+0x44e/0xf00 drivers/media/v4l2-core/v4l2-ioctl.c:3056 v4l2_ioctl+0x14e/0x1a0 drivers/media/v4l2-core/v4l2-dev.c:364 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xced/0x12f0 fs/ioctl.c:696 ksys_ioctl+0xa0/0xc0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x74/0xb0 fs/ioctl.c:718 do_syscall_64+0xcf/0x4f0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f3b56d8b347 Code: 90 90 90 48 8b 05 f1 fa 2a 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff
ff c3 90 90 90 90 90 90 90 90 90 90 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c1 fa 2a 00 31 d2 48 29 c2 64
RSP: 002b:00007ffe005d5d68 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f3b56d8b347
RDX: 00007ffe005d5d70 RSI: 0000000080685600 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000400884
R13: 00007ffe005d5ec0 R14: 0000000000000000 R15: 0000000000000000
==================================================================
For this device udev->product is not initialized and accessing it causes a NULL pointer deref.
The fix is to check for NULL before strscpy() and copy empty string, if product is NULL
--- drivers/media/usb/zr364xx/zr364xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/zr364xx/zr364xx.c +2 -1
@@ -711,7 +711,8 @@ static int zr364xx_vidioc_querycap(strucstruct zr364xx_camera *cam =video_drvdata (file);strlcpy (cap->driver,DRIVER_DESC ,sizeof (cap->driver)); -strlcpy (cap->card, cam->udev->product,sizeof (cap->card)); +if (cam->udev->product) +strlcpy (cap->card, cam->udev->product,sizeof (cap->card));strlcpy (cap->bus_info,dev_name (&cam->udev->dev),sizeof (cap->bus_info)); cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
Greg Kroah-Hartman
maintainerPATCH 9/76 ALSA: line6: Fix write on zero-sized buffer
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 3450121997ce872eb7f1248417225827ea249710 upstream.
LINE6 drivers allocate the buffers based on the value returned from usb_maxpacket() calls. The manipulated device may return zero for this, and this results in the kmalloc() with zero size (and it may succeed) while the other part of the driver code writes the packet data with the fixed size -- which eventually overwrites.
This patch adds a simple sanity check for the invalid buffer size for avoiding that problem.
[bwh: Backported to 4.4: Driver doesn't support asymmetrical packet
sizes, so only check snd_line6_pcm::max_packet_size]
--- sound/usb/line6/pcm.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/usb/line6/pcm.c +5 -0
@@ -529,6 +529,11 @@ int line6_init_pcm(struct usb_line6 *lin usb_rcvisocpipe(line6->usbdev, ep_read), 0),usb_maxpacket (line6->usbdev, usb_sndisocpipe(line6->usbdev, ep_write), 1)); +if (!line6pcm->max_packet_size) { +dev_err (line6pcm->line6->ifcdev, +"cannot get proper max packet size\n" ); +return -EINVAL ; + }spin_lock_init (&line6pcm->out.lock);spin_lock_init (&line6pcm->in.lock);
Greg Kroah-Hartman
maintainerPATCH 31/76 tty: serial: imx: use the sg count from dma_map_sg
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
commit 596fd8dffb745afcebc0ec6968e17fe29f02044c upstream.
The dmaengine_prep_slave_sg needs to use sg count returned by dma_map_sg, not use sport->dma_tx_nents, because the return value of dma_map_sg is not always same with "nents".
--- drivers/tty/serial/imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/imx.c +1 -1
@@ -545,7 +545,7 @@ static void imx_dma_tx(struct imx_port *dev_err (dev,"DMA mapping error for TX.\n" );return ; } - desc =dmaengine_prep_slave_sg (chan, sgl, sport->dma_tx_nents, + desc =dmaengine_prep_slave_sg (chan, sgl, ret,DMA_MEM_TO_DEV ,DMA_PREP_INTERRUPT );if (!desc) { dma_unmap_sg(dev, sgl, sport->dma_tx_nents,
Greg Kroah-Hartman
maintainercover 4.4.211-stable review
This is the start of the stable review cycle for the 4.4.211 release. There are 76 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 Fri, 24 Jan 2020 09:25:24 +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.211-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.211-rc1
Stephan Gerhold <[email protected]>
regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id
Masami Hiramatsu <[email protected]>
perf probe: Fix wrong address verification
Bart Van Assche <[email protected]>
scsi: core: scsi_trace: Use get_unaligned_be*()
Bart Van Assche <[email protected]>
scsi: target: core: Fix a pr_debug() argument
Pan Bian <[email protected]>
scsi: bnx2i: fix potential use after free
Pan Bian <[email protected]>
scsi: qla4xxx: fix double free bug
Dan Carpenter <[email protected]>
scsi: esas2r: unlock on error in esas2r_nvram_read_direct()
Johannes Berg <[email protected]>
cfg80211: check for set_wiphy_params
Dan Carpenter <[email protected]>
cw1200: Fix a signedness bug in cw1200_load_firmware()
Nathan Chancellor <[email protected]>
xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk
Eric Dumazet <[email protected]>
net: usb: lan78xx: limit size of local TSO packets
Pengcheng Yang <[email protected]>
tcp: fix marked lost packets not being retransmitted
Johan Hovold <[email protected]>
r8152: add missing endpoint sanity check
Eric Dumazet <[email protected]>
macvlan: use skb_reset_mac_header() in macvlan_queue_xmit()
Sven Eckelmann <[email protected]>
batman-adv: Fix DAT candidate selection on little endian systems
Cong Wang <[email protected]>
netfilter: fix a use-after-free in mtype_destroy()
Dinh Nguyen <[email protected]>
arm64: dts: agilex/stratix10: fix pmu interrupt numbers
Arnd Bergmann <[email protected]>
scsi: fnic: fix invalid stack access
Andy Shevchenko <[email protected]>
scsi: fnic: use kernel's '%pM' format option to print MAC
Johan Hovold <[email protected]>
USB: serial: keyspan: handle unbound ports
Johan Hovold <[email protected]>
USB: serial: io_edgeport: handle unbound ports on URB completion
John Ogness <[email protected]>
USB: serial: io_edgeport: use irqsave() in USB's complete callback
Jose Abreu <[email protected]>
net: stmmac: Enable 16KB buffer size
Jose Abreu <[email protected]>
net: stmmac: 16KB buffer must be 16 byte aligned
Wen Yang <[email protected]>
mm/page-writeback.c: avoid potential division by zero in wb_min_max_ratio()
Ard Biesheuvel <[email protected]>
x86/efistub: Disable paging at mixed mode entry
Keiya Nobuta <[email protected]>
usb: core: hub: Improved device recognition on remote wakeup
Dan Carpenter <[email protected]>
scsi: mptfusion: Fix double fetch bug in ioctl
Johan Hovold <[email protected]>
USB: serial: quatech2: handle unbound ports
Johan Hovold <[email protected]>
USB: serial: io_edgeport: add missing active-port sanity check
Johan Hovold <[email protected]>
USB: serial: ch341: handle unbound port at reset_resume
Johan Hovold <[email protected]>
USB: serial: suppress driver bind attributes
Johan Hovold <[email protected]>
USB: serial: opticon: fix control-message timeouts
Jerónimo Borque <[email protected]>
USB: serial: simple: Add Motorola Solutions TETRA MTP3xxx and MTP85xx
Mikulas Patocka <[email protected]>
block: fix an integer overflow in logical block size
Jari Ruusu <[email protected]>
Fix built-in early-load Intel microcode alignment
Takashi Iwai <[email protected]>
ALSA: seq: Fix racy access for queue timer in proc read
Kai Li <[email protected]>
ocfs2: call journal flush to mark journal as empty after journal recovery when mount
Nick Desaulniers <[email protected]>
hexagon: work around compiler crash
Mathieu Desnoyers <[email protected]>
rseq/selftests: Turn off timeout setting
Kars de Jong <[email protected]>
rtc: msm6242: Fix reading of 10-hour digit
Nathan Chancellor <[email protected]>
rtlwifi: Remove unnecessary NULL check in rtl_regd_init
Mans Rullgard <[email protected]>
spi: atmel: fix handling of cs_change set on non-last xfer
Seung-Woo Kim <[email protected]>
media: exynos4-is: Fix recursive locking in isp_video_release()
Peng Fan <[email protected]>
tty: serial: pch_uart: correct usage of dma_unmap_sg
Peng Fan <[email protected]>
tty: serial: imx: use the sg count from dma_map_sg
Arnd Bergmann <[email protected]>
compat_ioctl: handle SIOCOUTQNSD
Marian Mihailescu <[email protected]>
clk: samsung: exynos5420: Preserve CPU clocks configuration during suspend/resume
Alexander Usyskin <[email protected]>
mei: fix modalias documentation
Alexandru Ardelean <[email protected]>
iio: imu: adis16480: assign bias value only if operation succeeded
Jian-Hong Pan <[email protected]>
platform/x86: asus-wmi: Fix keyboard brightness cannot be set to 0
Xiang Chen <[email protected]>
scsi: sd: Clear sdkp->protection_type if disk is reformatted without PI
James Bottomley <[email protected]>
scsi: enclosure: Fix stale device oops with hot replug
Bart Van Assche <[email protected]>
RDMA/srpt: Report the SCSI residual to the initiator
Nathan Chancellor <[email protected]>
cifs: Adjust indentation in smb2_open_file
Taehee Yoo <[email protected]>
hsr: reset network header when supervision frame is created
Geert Uytterhoeven <[email protected]>
gpio: Fix error message on out-of-range GPIO in lookup table
Jon Derrick <[email protected]>
iommu: Remove device link to group on failure
Ran Bi <[email protected]>
rtc: mt6397: fix alarm register overwrite
YueHaibing <[email protected]>
dccp: Fix memleak in __feat_register_sp
Theodore Ts'o <[email protected]>
ext4: add more paranoia checking in ext4_expand_extra_isize handling
Barret Rhoden <[email protected]>
ext4: fix use-after-free race with debug_want_extra_isize
Navid Emamdoost <[email protected]>
wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
Navid Emamdoost <[email protected]>
wimax: i2400: fix memory leak
Juergen Gross <[email protected]>
xen: let alloc_xenballooned_pages() fail if not enough memory free
Igor Redko <[email protected]>
mm/page_alloc.c: calculate 'available' memory in a separate function
Takashi Iwai <[email protected]>
ALSA: line6: Fix memory leak at line6_init_pcm() error path
Takashi Iwai <[email protected]>
ALSA: line6: Fix write on zero-sized buffer
Alan Stern <[email protected]>
p54usb: Fix race between disconnect and firmware loading
Vandana BN <[email protected]>
media: usb:zr364xx:Fix KASAN:null-ptr-deref Read in zr364xx_vidioc_querycap
Jouni Malinen <[email protected]>
mac80211: Do not send Layer 2 Update frame before authorization
Dedy Lansky <[email protected]>
cfg80211/mac80211: make ieee80211_send_layer2_update a public function
Sanjay Konduri <[email protected]>
rsi: add fix for crash during assertions
Jiri Kosina <[email protected]>
HID: hidraw, uhid: Always report EPOLLOUT
Marcel Holtmann <[email protected]>
HID: hidraw: Fix returning EPOLLOUT from hidraw_poll
Fabian Henneke <[email protected]>
hidraw: Return EPOLLOUT from hidraw_poll
-------------
Diffstat:
Documentation/ABI/testing/sysfs-bus-mei | 2 +- Makefile | 4 +- arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 8 +- arch/hexagon/kernel/stacktrace.c | 4 +- arch/x86/boot/compressed/head_64.S | 5 + block/blk-settings.c | 2 +- drivers/block/xen-blkfront.c | 4 +- drivers/clk/samsung/clk-exynos5420.c | 2 + drivers/gpio/gpiolib.c | 5 +- drivers/hid/hidraw.c | 7 +- drivers/hid/uhid.c | 5 +- drivers/iio/imu/adis16480.c | 6 +- drivers/infiniband/ulp/srpt/ib_srpt.c | 24 +++ drivers/iommu/iommu.c | 1 + drivers/md/dm-snap-persistent.c | 2 +- drivers/md/raid0.c | 2 +- drivers/media/platform/exynos4-is/fimc-isp-video.c | 2 +- drivers/media/usb/zr364xx/zr364xx.c | 3 +- drivers/message/fusion/mptctl.c | 213 +++++---------------- drivers/misc/enclosure.c | 3 +- drivers/net/ethernet/stmicro/stmmac/common.h | 4 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +- drivers/net/macvlan.c | 5 +- drivers/net/usb/lan78xx.c | 1 + drivers/net/usb/r8152.c | 3 + drivers/net/wimax/i2400m/op-rfkill.c | 1 + drivers/net/wireless/cw1200/fwio.c | 6 +- drivers/net/wireless/p54/p54usb.c | 43 ++--- drivers/net/wireless/realtek/rtlwifi/regd.c | 2 +- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 1 + drivers/platform/x86/asus-wmi.c | 8 +- drivers/rtc/rtc-msm6242.c | 3 +- drivers/rtc/rtc-mt6397.c | 47 +++-- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/esas2r/esas2r_flash.c | 1 + drivers/scsi/fnic/vnic_dev.c | 30 ++- drivers/scsi/qla4xxx/ql4_mbx.c | 3 - drivers/scsi/scsi_trace.c | 114 ++++------- drivers/scsi/sd.c | 4 +- drivers/spi/spi-atmel.c | 10 +- drivers/target/target_core_fabric_lib.c | 2 +- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/pch_uart.c | 5 +- drivers/usb/core/hub.c | 1 + drivers/usb/serial/ch341.c | 6 +- drivers/usb/serial/io_edgeport.c | 33 ++-- drivers/usb/serial/keyspan.c | 4 + drivers/usb/serial/opticon.c | 2 +- drivers/usb/serial/quatech2.c | 6 + drivers/usb/serial/usb-serial-simple.c | 2 + drivers/usb/serial/usb-serial.c | 3 + drivers/xen/balloon.c | 16 +- firmware/Makefile | 2 +- fs/cifs/smb2file.c | 2 +- fs/ext4/inode.c | 15 ++ fs/ext4/super.c | 60 +++--- fs/ocfs2/journal.c | 8 + fs/proc/meminfo.c | 31 +-- include/linux/blkdev.h | 8 +- include/linux/mm.h | 1 + include/linux/regulator/ab8500.h | 2 - include/net/cfg80211.h | 11 ++ mm/page-writeback.c | 4 +- mm/page_alloc.c | 43 +++++ net/batman-adv/distributed-arp-table.c | 4 +- net/dccp/feat.c | 7 +- net/hsr/hsr_device.c | 2 + net/ipv4/tcp_input.c | 7 +- net/mac80211/cfg.c | 55 +----- net/mac80211/sta_info.c | 4 + net/netfilter/ipset/ip_set_bitmap_gen.h | 2 +- net/socket.c | 1 + net/wireless/rdev-ops.h | 4 + net/wireless/util.c | 45 +++++ sound/core/seq/seq_timer.c | 14 +- sound/usb/line6/pcm.c | 19 +- tools/perf/util/probe-finder.c | 32 +--- tools/testing/selftests/rseq/settings | 1 + 78 files changed, 529 insertions(+), 533 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 42/76 block: fix an integer overflow in logical block size
From: Mikulas Patocka <[email protected]>
commit ad6bf88a6c19a39fb3b0045d78ea880325dfcf15 upstream.
Logical block size has type unsigned short. That means that it can be at most 32768. However, there are architectures that can run with 64k pages (for example arm64) and on these architectures, it may be possible to create block devices with 64k block size.
For exmaple (run this on an architecture with 64k pages):
Mount will fail with this error because it tries to read the superblock using 2-sector access:
device-mapper: writecache: I/O is not aligned, sector 2, size 1024, block size 65536 EXT4-fs (dm-0): unable to read superblock
This patch changes the logical block size from unsigned short to unsigned int to avoid the overflow.
--- block/blk-settings.c | 2 +- drivers/md/dm-snap-persistent.c | 2 +- drivers/md/raid0.c | 2 +- include/linux/blkdev.h | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-)
block/blk-settings.c +1 -1
@@ -349,7 +349,7 @@ EXPORT_SYMBOL(blk_queue_max_segment_size* storage device can address. The default of 512 covers most * hardware. **/ -void blk_queue_logical_block_size (struct request_queue *q,unsigned short size) +void blk_queue_logical_block_size (struct request_queue *q,unsigned int size) { q->limits.logical_block_size = size;
drivers/md/dm-snap-persistent.c +1 -1
@@ -17,7 +17,7 @@#include "dm-bufio.h" #define DM_MSG_PREFIX "persistent snapshot" -#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32/* 16KB */ +#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32U/* 16KB */ #define DM_PREFETCH_CHUNKS 12
drivers/md/raid0.c +1 -1
@@ -83,7 +83,7 @@ static int create_strip_zones(struct mddchar b[BDEVNAME_SIZE ];char b2[BDEVNAME_SIZE ];struct r0conf *conf =kzalloc (sizeof (*conf),GFP_KERNEL ); -unsigned short blksize =512 ; +unsigned blksize =512 ;if (!conf)return -ENOMEM ;
include/linux/blkdev.h +4 -4
@@ -264,6 +264,7 @@ struct queue_limits {unsigned int max_sectors;unsigned int max_segment_size;unsigned int physical_block_size; +unsigned int logical_block_size;unsigned int alignment_offset;unsigned int io_min;unsigned int io_opt;
@@ -273,7 +274,6 @@ struct queue_limits {unsigned int discard_granularity;unsigned int discard_alignment; -unsigned short logical_block_size;unsigned short max_segments;unsigned short max_integrity_segments;
@@ -975,7 +975,7 @@ extern void blk_queue_max_discard_sector unsigned int max_discard_sectors);extern void blk_queue_max_write_same_sectors (struct request_queue *q,unsigned int max_write_same_sectors); -extern void blk_queue_logical_block_size (struct request_queue *,unsigned short ); +extern void blk_queue_logical_block_size (struct request_queue *,unsigned int );extern void blk_queue_physical_block_size (struct request_queue *,unsigned int );extern void blk_queue_alignment_offset (struct request_queue *q,unsigned int alignment);
@@ -1193,7 +1193,7 @@ static inline unsigned int queue_max_segreturn q->limits.max_segment_size; } -static inline unsigned short queue_logical_block_size (struct request_queue *q) +static inline unsigned queue_logical_block_size (struct request_queue *q) {int retval =512 ;
@@ -1203,7 +1203,7 @@ static inline unsigned short queue_logicreturn retval; } -static inline unsigned short bdev_logical_block_size (struct block_device *bdev) +static inline unsigned int bdev_logical_block_size (struct block_device *bdev) {return queue_logical_block_size (bdev_get_queue (bdev)); }
Greg Kroah-Hartman
maintainerPATCH 40/76 ALSA: seq: Fix racy access for queue timer in proc read
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 60adcfde92fa40fcb2dbf7cc52f9b096e0cd109a upstream.
snd_seq_info_timer_read() reads the information of the timer assigned for each queue, but it's done in a racy way which may lead to UAF as spotted by syzkaller.
This patch applies the missing q->timer_mutex lock while accessing the timer object as well as a slight code change to adapt the standard coding style.
--- sound/core/seq/seq_timer.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
sound/core/seq/seq_timer.c +9 -5
@@ -484,15 +484,19 @@ void snd_seq_info_timer_read(struct snd_ q =queueptr (idx);if (q ==NULL )continue ; -if ((tmr = q->timer) ==NULL || - (ti = tmr->timeri) ==NULL ) { -queuefree (q); -continue ; - } +mutex_lock (&q->timer_mutex); + tmr = q->timer; +if (!tmr) + goto unlock; + ti = tmr->timeri; +if (!ti) + goto unlock;snd_iprintf (buffer,"Timer for queue %i : %s\n" , q->queue, ti->timer->name); resolution =snd_timer_resolution (ti) * tmr->ticks;snd_iprintf (buffer," Period time : %lu.%09lu\n" , resolution /1000000000 , resolution %1000000000 );snd_iprintf (buffer," Skew : %u / %u\n" , tmr->skew, tmr->skew_base); +unlock: +mutex_unlock (&q->timer_mutex);queuefree (q); } }
Greg Kroah-Hartman
maintainerPATCH 43/76 USB: serial: simple: Add Motorola Solutions TETRA MTP3xxx and MTP85xx
In reply to Greg Kroah-HartmanFrom: Jerónimo Borque <[email protected]>
commit 260e41ac4dd3e5acb90be624c03ba7f019615b75 upstream.
Add device-ids for the Motorola Solutions TETRA radios MTP3xxx series and MTP85xx series
$ lsusb -vd 0cad:
Bus 001 Device 009: ID 0cad:9015 Motorola CGISS TETRA PEI interface Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0cad Motorola CGISS idProduct 0x9015 bcdDevice 24.16 iManufacturer 1 iProduct 2 iSerial 0 bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0037
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 3
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Bus 001 Device 010: ID 0cad:9013 Motorola CGISS TETRA PEI interface Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0cad Motorola CGISS idProduct 0x9013 bcdDevice 24.16 iManufacturer 1 iProduct 2 iSerial 0 bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0037
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 3
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
--- drivers/usb/serial/usb-serial-simple.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/usb-serial-simple.c +2 -0
@@ -89,6 +89,8 @@ DEVICE(moto_modem, MOTO_IDS);#define MOTOROLA_TETRA_IDS () \ { USB_DEVICE(0x0cad, 0x9011) },/* Motorola Solutions TETRA PEI */ \ { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \ + { USB_DEVICE(0x0cad, 0x9013) }, /* MTP3xxx */ \ + { USB_DEVICE(0x0cad, 0x9015) }, /* MTP85xx */ \ { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */DEVICE (motorola_tetra,MOTOROLA_TETRA_IDS );
Greg Kroah-Hartman
maintainerPATCH 41/76 Fix built-in early-load Intel microcode alignment
In reply to Greg Kroah-HartmanFrom: Jari Ruusu <[email protected]>
commit f5ae2ea6347a308cfe91f53b53682ce635497d0d upstream.
Intel Software Developer's Manual, volume 3, chapter 9.11.6 says:
"Note that the microcode update must be aligned on a 16-byte boundary
and the size of the microcode update must be 1-KByte granular"
When early-load Intel microcode is loaded from initramfs, userspace tool 'iucode_tool' has already 16-byte aligned those microcode bits in that initramfs image. Image that was created something like this:
iucode_tool --write-earlyfw=FOO.cpio microcode-files...
However, when early-load Intel microcode is loaded from built-in firmware BLOB using CONFIG_EXTRA_FIRMWARE= kernel config option, that 16-byte alignment is not guaranteed.
Fix this by forcing all built-in firmware BLOBs to 16-byte alignment.
[ If we end up having other firmware with much bigger alignment
requirements, we might need to introduce some method for the firmware to specify it, this is the minimal "just increase the alignment a bit
to account for this one special case" patch - Linus ]
--- firmware/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
firmware/Makefile +1 -1
@@ -156,7 +156,7 @@ quiet_cmd_fwbin = MK_FW $@ PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \ echo "/* Generated by firmware/Makefile */" > $@;\ echo " .section .rodata" >>$@;\ - echo " .p2align $${ASM_ALIGN}" >>$@;\ + echo " .p2align 4" >>$@;\ echo "_fw_$${FWSTR}_bin:" >>$@;\ echo " .incbin \"$(2)\"" >>$@;\ echo "_fw_end:" >>$@;\
Greg Kroah-Hartman
maintainerPATCH 44/76 USB: serial: opticon: fix control-message timeouts
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 5e28055f340275a8616eee88ef19186631b4d136 upstream.
The driver was issuing synchronous uninterruptible control requests without using a timeout. This could lead to the driver hanging on open() or tiocmset() due to a malfunctioning (or malicious) device until the device is physically disconnected.
The USB upper limit of five seconds per request should be more than enough.
--- drivers/usb/serial/opticon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/opticon.c +1 -1
@@ -116,7 +116,7 @@ static int send_control_msg(struct usb_s retval =usb_control_msg (serial->dev,usb_sndctrlpipe (serial->dev,0 ), requesttype,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_INTERFACE , -0 ,0 , buffer,1 ,0 ); +0 ,0 , buffer,1 ,USB_CTRL_SET_TIMEOUT );kfree (buffer);if (retval <0 )
Greg Kroah-Hartman
maintainerPATCH 48/76 USB: serial: quatech2: handle unbound ports
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 9715a43eea77e42678a1002623f2d9a78f5b81a1 upstream.
Check for NULL port data in the modem- and line-status handlers to avoid dereferencing a NULL pointer in the unlikely case where a port device isn't bound to a driver (e.g. after an allocation failure on port probe).
Note that the other (stubbed) event handlers qt2_process_xmit_empty() and qt2_process_flush() would need similar sanity checks in case they are ever implemented.
--- drivers/usb/serial/quatech2.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/quatech2.c +6 -0
@@ -872,7 +872,10 @@ static void qt2_update_msr(struct usb_seu8 newMSR = (u8) *ch;unsigned long flags; +/* May be called from qt2_process_read_urb() for an unbound port. */ port_priv =usb_get_serial_port_data (port); +if (!port_priv) +return ;spin_lock_irqsave (&port_priv->lock, flags); port_priv->shadowMSR = newMSR;
@@ -900,7 +903,10 @@ static void qt2_update_lsr(struct usb_seunsigned long flags;u8 newLSR = (u8) *ch; +/* May be called from qt2_process_read_urb() for an unbound port. */ port_priv =usb_get_serial_port_data (port); +if (!port_priv) +return ;if (newLSR &UART_LSR_BI ) newLSR &= (u8) (UART_LSR_OE |UART_LSR_BI );
Greg Kroah-Hartman
maintainerPATCH 49/76 scsi: mptfusion: Fix double fetch bug in ioctl
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 28d76df18f0ad5bcf5fa48510b225f0ed262a99b upstream.
Tom Hatskevich reported that we look up "iocp" then, in the called functions we do a second copy_from_user() and look it up again. The problem that could cause is:
drivers/message/fusion/mptctl.c
674 /* All of these commands require an interrupt or
675 * are unknown/illegal.
676 */
677 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
^^^^
We take this lock.
678 return ret;
679
680 if (cmd == MPTFWDOWNLOAD)
681 ret = mptctl_fw_download(arg);
^^^Then the user memory changes and we look up "iocp" again but a different one so now we are holding the incorrect lock and have a race condition.
682 else if (cmd == MPTCOMMAND) 683 ret = mptctl_mpt_command(arg);
The security impact of this bug is not as bad as it could have been because these operations are all privileged and root already has enormous destructive power. But it's still worth fixing.
This patch passes the "iocp" pointer to the functions to avoid the second lookup. That deletes 100 lines of code from the driver so it's a nice clean up as well.
--- drivers/message/fusion/mptctl.c | 213 +++++++++------------------------------- 1 file changed, 50 insertions(+), 163 deletions(-)
drivers/message/fusion/mptctl.c +50 -163
@@ -100,19 +100,19 @@ struct buflist {* Function prototypes. Called from OS entry point mptctl_ioctl. * arg contents specific to function. */ -static int mptctl_fw_download (unsigned long arg); -static int mptctl_getiocinfo (unsigned long arg,unsigned int cmd); -static int mptctl_gettargetinfo (unsigned long arg); -static int mptctl_readtest (unsigned long arg); -static int mptctl_mpt_command (unsigned long arg); -static int mptctl_eventquery (unsigned long arg); -static int mptctl_eventenable (unsigned long arg); -static int mptctl_eventreport (unsigned long arg); -static int mptctl_replace_fw (unsigned long arg); - -static int mptctl_do_reset (unsigned long arg); -static int mptctl_hp_hostinfo (unsigned long arg,unsigned int cmd); -static int mptctl_hp_targetinfo (unsigned long arg); +static int mptctl_fw_download (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_getiocinfo (MPT_ADAPTER *iocp,unsigned long arg,unsigned int cmd); +static int mptctl_gettargetinfo (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_readtest (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_mpt_command (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_eventquery (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_eventenable (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_eventreport (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_replace_fw (MPT_ADAPTER *iocp,unsigned long arg); + +static int mptctl_do_reset (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_hp_hostinfo (MPT_ADAPTER *iocp,unsigned long arg,unsigned int cmd); +static int mptctl_hp_targetinfo (MPT_ADAPTER *iocp,unsigned long arg);static int mptctl_probe (struct pci_dev *,const struct pci_device_id *);static void mptctl_remove (struct pci_dev *);
@@ -123,8 +123,8 @@ static long compat_mpctl_ioctl(struct fi/* * Private function calls. */ -static int mptctl_do_mpt_command (struct mpt_ioctl_command karg,void __user *mfPtr); -static int mptctl_do_fw_download (int ioc,char __user *ufwbuf,size_t fwlen); +static int mptctl_do_mpt_command (MPT_ADAPTER *iocp,struct mpt_ioctl_command karg,void __user *mfPtr); +static int mptctl_do_fw_download (MPT_ADAPTER *iocp,char __user *ufwbuf,size_t fwlen);static MptSge_t *kbuf_alloc_2_sgl (int bytes,u32 dir,int sge_offset,int *frags,struct buflist **blp,dma_addr_t *sglbuf_dma,MPT_ADAPTER *ioc); static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma,
@@ -656,19 +656,19 @@ __mptctl_ioctl(struct file *file, unsign* by TM and FW reloads. */ if ((cmd & ~IOCSIZE_MASK ) == (MPTIOCINFO & ~IOCSIZE_MASK )) { -return mptctl_getiocinfo (arg,_IOC_SIZE (cmd)); +return mptctl_getiocinfo (iocp, arg,_IOC_SIZE (cmd)); }else if (cmd ==MPTTARGETINFO ) { -return mptctl_gettargetinfo (arg); +return mptctl_gettargetinfo (iocp, arg); }else if (cmd ==MPTTEST ) { -return mptctl_readtest (arg); +return mptctl_readtest (iocp, arg); }else if (cmd ==MPTEVENTQUERY ) { -return mptctl_eventquery (arg); +return mptctl_eventquery (iocp, arg); }else if (cmd ==MPTEVENTENABLE ) { -return mptctl_eventenable (arg); +return mptctl_eventenable (iocp, arg); }else if (cmd ==MPTEVENTREPORT ) { -return mptctl_eventreport (arg); +return mptctl_eventreport (iocp, arg); }else if (cmd ==MPTFWREPLACE ) { -return mptctl_replace_fw (arg); +return mptctl_replace_fw (iocp, arg); }/* All of these commands require an interrupt or
@@ -678,15 +678,15 @@ __mptctl_ioctl(struct file *file, unsignreturn ret;if (cmd ==MPTFWDOWNLOAD ) - ret =mptctl_fw_download (arg); + ret =mptctl_fw_download (iocp, arg);else if (cmd ==MPTCOMMAND ) - ret =mptctl_mpt_command (arg); + ret =mptctl_mpt_command (iocp, arg);else if (cmd ==MPTHARDRESET ) - ret =mptctl_do_reset (arg); + ret =mptctl_do_reset (iocp, arg);else if ((cmd & ~IOCSIZE_MASK ) == (HP_GETHOSTINFO & ~IOCSIZE_MASK )) - ret =mptctl_hp_hostinfo (arg,_IOC_SIZE (cmd)); + ret =mptctl_hp_hostinfo (iocp, arg,_IOC_SIZE (cmd));else if (cmd ==HP_GETTARGETINFO ) - ret =mptctl_hp_targetinfo (arg); + ret =mptctl_hp_targetinfo (iocp, arg);else ret = -EINVAL ;
@@ -705,11 +705,10 @@ mptctl_ioctl(struct file *file, unsignedreturn ret; } -static int mptctl_do_reset (unsigned long arg) +static int mptctl_do_reset (MPT_ADAPTER *iocp,unsigned long arg) {struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg;struct mpt_ioctl_diag_reset krinfo; -MPT_ADAPTER *iocp;if (copy_from_user (&krinfo, urinfo,sizeof (struct mpt_ioctl_diag_reset ))) { printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - "
@@ -718,12 +717,6 @@ static int mptctl_do_reset(unsigned longreturn -EFAULT ; } -if (mpt_verify_adapter (krinfo.hdr.iocnum, &iocp) <0 ) { - printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n", - __FILE__, __LINE__, krinfo.hdr.iocnum); -return -ENODEV ;/* (-6) No such device or address */ - } -dctlprintk (iocp,printk (MYIOC_s_DEBUG_FMT"mptctl_do_reset called.\n" , iocp->name));
@@ -754,7 +747,7 @@ static int mptctl_do_reset(unsigned long* -ENOMSG if FW upload returned bad status */ static int -mptctl_fw_download (unsigned long arg) +mptctl_fw_download (MPT_ADAPTER *iocp,unsigned long arg) {struct mpt_fw_xfer __user *ufwdl = (void __user *) arg;struct mpt_fw_xfer kfwdl;
@@ -766,7 +759,7 @@ mptctl_fw_download(unsigned long arg)return -EFAULT ; } -return mptctl_do_fw_download (kfwdl.iocnum, kfwdl.bufp, kfwdl.fwlen); +return mptctl_do_fw_download (iocp, kfwdl.bufp, kfwdl.fwlen); }/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -784,11 +777,10 @@ mptctl_fw_download(unsigned long arg)* -ENOMSG if FW upload returned bad status */ static int -mptctl_do_fw_download (int ioc,char __user *ufwbuf,size_t fwlen) +mptctl_do_fw_download (MPT_ADAPTER *iocp,char __user *ufwbuf,size_t fwlen) {FWDownload_t *dlmsg;MPT_FRAME_HDR *mf; -MPT_ADAPTER *iocp;FWDownloadTCSGE_t *ptsge;MptSge_t *sgl, *sgIn;char *sgOut;
@@ -808,17 +800,10 @@ mptctl_do_fw_download(int ioc, char __uspFWDownloadReply_t ReplyMsg =NULL ;unsigned long timeleft; -if (mpt_verify_adapter (ioc, &iocp) <0 ) { - printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n", - ioc); -return -ENODEV ;/* (-6) No such device or address */ - }else { - -/* Valid device. Get a message frame and construct the FW download message. -*/ -if ((mf =mpt_get_msg_frame (mptctl_id, iocp)) ==NULL ) -return -EAGAIN ; - } +/* Valid device. Get a message frame and construct the FW download message. +*/ +if ((mf =mpt_get_msg_frame (mptctl_id, iocp)) ==NULL ) +return -EAGAIN ;dctlprintk (iocp,printk (MYIOC_s_DEBUG_FMT"mptctl_do_fwdl called. mptctl_id = %xh.\n" , iocp->name, mptctl_id));
@@ -826,8 +811,6 @@ mptctl_do_fw_download(int ioc, char __us iocp->name, ufwbuf));dctlprintk (iocp,printk (MYIOC_s_DEBUG_FMT"DbG: kfwdl.fwlen = %d\n" , iocp->name, (int )fwlen)); -dctlprintk (iocp,printk (MYIOC_s_DEBUG_FMT"DbG: kfwdl.ioc = %04xh\n" , - iocp->name, ioc)); dlmsg = (FWDownload_t *) mf; ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL;
@@ -1238,13 +1221,11 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_* -ENODEV if no such device/adapter */ static int -mptctl_getiocinfo (unsigned long arg,unsigned int data_size) +mptctl_getiocinfo (MPT_ADAPTER *ioc,unsigned long arg,unsigned int data_size) {struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg;struct mpt_ioctl_iocinfo *karg; -MPT_ADAPTER *ioc;struct pci_dev *pdev; -int iocnum;unsigned int port;int cim_rev;struct scsi_device *sdev;
@@ -1272,14 +1253,6 @@ mptctl_getiocinfo (unsigned long arg, unreturn PTR_ERR (karg); } -if (((iocnum =mpt_verify_adapter (karg->hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -kfree (karg); -return -ENODEV ; - } -/* Verify the data transfer size is correct. */ if (karg->hdr.maxDataSize != data_size) { printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
@@ -1385,15 +1358,13 @@ mptctl_getiocinfo (unsigned long arg, un* -ENODEV if no such device/adapter */ static int -mptctl_gettargetinfo (unsigned long arg) +mptctl_gettargetinfo (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg;struct mpt_ioctl_targetinfo karg; -MPT_ADAPTER *ioc;VirtDevice *vdevice;char *pmem;int *pdata; -int iocnum;int numDevices =0 ;int lun;int maxWordsLeft;
@@ -1408,13 +1379,6 @@ mptctl_gettargetinfo (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_gettargetinfo called.\n" , ioc->name));/* Get the port number and set the maximum number of bytes
@@ -1510,12 +1474,10 @@ mptctl_gettargetinfo (unsigned long arg)* -ENODEV if no such device/adapter */ static int -mptctl_readtest (unsigned long arg) +mptctl_readtest (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_test __user *uarg = (void __user *) arg;struct mpt_ioctl_test karg; -MPT_ADAPTER *ioc; -int iocnum;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_test ))) { printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - "
@@ -1524,13 +1486,6 @@ mptctl_readtest (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_readtest called.\n" , ioc->name));/* Fill in the data and return the structure to the calling
@@ -1571,12 +1526,10 @@ mptctl_readtest (unsigned long arg)* -ENODEV if no such device/adapter */ static int -mptctl_eventquery (unsigned long arg) +mptctl_eventquery (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg;struct mpt_ioctl_eventquery karg; -MPT_ADAPTER *ioc; -int iocnum;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_eventquery ))) { printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - "
@@ -1585,13 +1538,6 @@ mptctl_eventquery (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_eventquery called.\n" , ioc->name)); karg.eventEntries =MPTCTL_EVENT_LOG_SIZE ;
@@ -1610,12 +1556,10 @@ mptctl_eventquery (unsigned long arg)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ static int -mptctl_eventenable (unsigned long arg) +mptctl_eventenable (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg;struct mpt_ioctl_eventenable karg; -MPT_ADAPTER *ioc; -int iocnum;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_eventenable ))) { printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - "
@@ -1624,13 +1568,6 @@ mptctl_eventenable (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_eventenable called.\n" , ioc->name));if (ioc->events ==NULL ) {
@@ -1658,12 +1595,10 @@ mptctl_eventenable (unsigned long arg)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ static int -mptctl_eventreport (unsigned long arg) +mptctl_eventreport (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg;struct mpt_ioctl_eventreport karg; -MPT_ADAPTER *ioc; -int iocnum;int numBytes, maxEvents, max;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_eventreport ))) {
@@ -1673,12 +1608,6 @@ mptctl_eventreport (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - }dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_eventreport called.\n" , ioc->name));
@@ -1712,12 +1641,10 @@ mptctl_eventreport (unsigned long arg)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ static int -mptctl_replace_fw (unsigned long arg) +mptctl_replace_fw (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg;struct mpt_ioctl_replace_fw karg; -MPT_ADAPTER *ioc; -int iocnum;int newFwSize;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_replace_fw ))) {
@@ -1727,13 +1654,6 @@ mptctl_replace_fw (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_replace_fw called.\n" , ioc->name));/* If caching FW, Free the old FW image
@@ -1780,12 +1700,10 @@ mptctl_replace_fw (unsigned long arg)* -ENOMEM if memory allocation error */ static int -mptctl_mpt_command (unsigned long arg) +mptctl_mpt_command (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_command __user *uarg = (void __user *) arg;struct mpt_ioctl_command karg; -MPT_ADAPTER *ioc; -int iocnum;int rc;
@@ -1796,14 +1714,7 @@ mptctl_mpt_command (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } - - rc =mptctl_do_mpt_command (karg, &uarg->MF); + rc =mptctl_do_mpt_command (ioc, karg, &uarg->MF);return rc; }
@@ -1821,9 +1732,8 @@ mptctl_mpt_command (unsigned long arg)* -EPERM if SCSI I/O and target is untagged */ static int -mptctl_do_mpt_command (struct mpt_ioctl_command karg,void __user *mfPtr) +mptctl_do_mpt_command (MPT_ADAPTER *ioc,struct mpt_ioctl_command karg,void __user *mfPtr) { -MPT_ADAPTER *ioc;MPT_FRAME_HDR *mf =NULL ;MPIHeader_t *hdr;char *psge;
@@ -1832,7 +1742,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_dma_addr_t dma_addr_in;dma_addr_t dma_addr_out;int sgSize =0 ;/* Num SG elements */ -int iocnum, flagsLength; +int flagsLength;int sz, rc =0 ;int msgContext;u16 req_idx;
@@ -1847,13 +1757,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_ bufIn.kptr = bufOut.kptr =NULL ; bufIn.len = bufOut.len =0 ; -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -spin_lock_irqsave (&ioc->taskmgmt_lock, flags);if (ioc->ioc_reset_in_progress) {spin_unlock_irqrestore (&ioc->taskmgmt_lock, flags);
@@ -2418,17 +2321,15 @@ done_free_mem:* -ENOMEM if memory allocation error */ static int -mptctl_hp_hostinfo (unsigned long arg,unsigned int data_size) +mptctl_hp_hostinfo (MPT_ADAPTER *ioc,unsigned long arg,unsigned int data_size) {hp_host_info_t __user *uarg = (void __user *) arg; -MPT_ADAPTER *ioc;struct pci_dev *pdev;char *pbuf=NULL ;dma_addr_t buf_dma;hp_host_info_t karg;CONFIGPARMS cfg;ConfigPageHeader_t hdr; -int iocnum;int rc, cim_rev;ToolboxIstwiReadWriteRequest_t *IstwiRWRequest;MPT_FRAME_HDR *mf =NULL ;
@@ -2452,12 +2353,6 @@ mptctl_hp_hostinfo(unsigned long arg, unreturn -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - }dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT": mptctl_hp_hostinfo called.\n" , ioc->name));
@@ -2670,15 +2565,13 @@ retry_wait:* -ENOMEM if memory allocation error */ static int -mptctl_hp_targetinfo (unsigned long arg) +mptctl_hp_targetinfo (MPT_ADAPTER *ioc,unsigned long arg) {hp_target_info_t __user *uarg = (void __user *) arg;SCSIDevicePage0_t *pg0_alloc;SCSIDevicePage3_t *pg3_alloc; -MPT_ADAPTER *ioc;MPT_SCSI_HOST *hd =NULL ;hp_target_info_t karg; -int iocnum;int data_sz;dma_addr_t page_dma;CONFIGPARMS cfg;
@@ -2692,12 +2585,6 @@ mptctl_hp_targetinfo(unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - }if (karg.hdr.id >=MPT_MAX_FC_DEVICES )return -EINVAL ; dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n",
@@ -2865,7 +2752,7 @@ compat_mptfwxfer_ioctl(struct file *filp kfw.fwlen = kfw32.fwlen; kfw.bufp =compat_ptr (kfw32.bufp); - ret =mptctl_do_fw_download (kfw.iocnum, kfw.bufp, kfw.fwlen); + ret =mptctl_do_fw_download (iocp, kfw.bufp, kfw.fwlen);mutex_unlock (&iocp->ioctl_cmds.mutex);
@@ -2919,7 +2806,7 @@ compat_mpt_command(struct file *filp, un/* Pass new structure to do_mpt_command */ - ret =mptctl_do_mpt_command (karg, &uarg->MF); + ret =mptctl_do_mpt_command (iocp, karg, &uarg->MF);mutex_unlock (&iocp->ioctl_cmds.mutex);
Greg Kroah-Hartman
maintainerPATCH 50/76 usb: core: hub: Improved device recognition on remote wakeup
In reply to Greg Kroah-HartmanFrom: Keiya Nobuta <[email protected]>
commit 9c06ac4c83df6d6fbdbf7488fbad822b4002ba19 upstream.
If hub_activate() is called before D+ has stabilized after remote wakeup, the following situation might occur:
__ ___________________
/ \ /D+ __/ \__/
Hub _______________________________
| ^ ^ ^
| | | |
Host _____v__|___|___________|______
| | | |
| | | \-- Interrupt Transfer (*3)
| | \-- ClearPortFeature (*2) | \-- GetPortStatus (*1)
\-- Host detects remote wakeup
- D+ goes high, Host starts running by remote wakeup
- D+ is not stable, goes low
- Host requests GetPortStatus at (*1) and gets the following hub status:
- Current Connect Status bit is 0
- Connect Status Change bit is 1
- D+ stabilizes, goes high
- Host requests ClearPortFeature and thus Connect Status Change bit is cleared at (*2)
- After waiting 100 ms, Host starts the Interrupt Transfer at (*3)
- Since the Connect Status Change bit is 0, Hub returns NAK.
In this case, port_event() is not called in hub_event() and Host cannot recognize device. To solve this issue, flag change_bits even if only Connect Status Change bit is 1 when got in the first GetPortStatus.
This issue occurs rarely because it only if D+ changes during a very short time between GetPortStatus and ClearPortFeature. However, it is fatal if it occurs in embedded system.
--- drivers/usb/core/hub.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/core/hub.c +1 -0
@@ -1146,6 +1146,7 @@ static void hub_activate(struct usb_hub* PORT_OVER_CURRENT is not. So check for any of them. */ if (udev || (portstatus &USB_PORT_STAT_CONNECTION ) || + (portchange &USB_PORT_STAT_C_CONNECTION ) || (portstatus &USB_PORT_STAT_OVERCURRENT ) || (portchange &USB_PORT_STAT_C_OVERCURRENT ))set_bit (port1, hub->change_bits);
Greg Kroah-Hartman
maintainerPATCH 51/76 x86/efistub: Disable paging at mixed mode entry
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit 4911ee401b7ceff8f38e0ac597cbf503d71e690c upstream.
The EFI mixed mode entry code goes through the ordinary startup_32() routine before jumping into the kernel's EFI boot code in 64-bit mode. The 32-bit startup code must be entered with paging disabled, but this is not documented as a requirement for the EFI handover protocol, and so we should disable paging explicitly when entering the kernel from 32-bit EFI firmware.
--- arch/x86/boot/compressed/head_64.S | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/boot/compressed/head_64.S +5 -0
@@ -225,6 +225,11 @@ ENTRY(efi32_stub_entry) leal efi32_config(%ebp), %eax movl %eax, efi_config(%ebp) + /* Disable paging */ + movl %cr0, %eax + btrl $X86_CR0_PG_BIT, %eax + movl %eax, %cr0 + jmp startup_32 ENDPROC(efi32_stub_entry) #endif
Greg Kroah-Hartman
maintainerPATCH 52/76 mm/page-writeback.c: avoid potential division by zero in wb_min_max_ratio()
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
commit 6d9e8c651dd979aa666bee15f086745f3ea9c4b3 upstream.
Patch series "use div64_ul() instead of div_u64() if the divisor is unsigned long".
We were first inspired by commit b0ab99e7736a ("sched: Fix possible divide by zero in avg_atom () calculation"), then refer to the recently analyzed mm code, we found this suspicious place.
201 if (min) {
202 min *= this_bw;
203 do_div(min, tot_bw);
204 }
And we also disassembled and confirmed it:
/usr/src/debug/kernel-4.9.168-016.ali3000/linux-4.9.168-016.ali3000.alios7.x86_64/mm/page-writeback.c: 201
0xffffffff811c37da <__wb_calc_thresh+234>: xor %r10d,%r10d 0xffffffff811c37dd <__wb_calc_thresh+237>: test %rax,%rax 0xffffffff811c37e0 <__wb_calc_thresh+240>: je 0xffffffff811c3800 <__wb_calc_thresh+272> /usr/src/debug/kernel-4.9.168-016.ali3000/linux-4.9.168-016.ali3000.alios7.x86_64/mm/page-writeback.c: 202 0xffffffff811c37e2 <__wb_calc_thresh+242>: imul %r8,%rax /usr/src/debug/kernel-4.9.168-016.ali3000/linux-4.9.168-016.ali3000.alios7.x86_64/mm/page-writeback.c: 203 0xffffffff811c37e6 <__wb_calc_thresh+246>: mov %r9d,%r10d ---> truncates it to 32 bits here 0xffffffff811c37e9 <__wb_calc_thresh+249>: xor %edx,%edx 0xffffffff811c37eb <__wb_calc_thresh+251>: div %r10 0xffffffff811c37ee <__wb_calc_thresh+254>: imul %rbx,%rax 0xffffffff811c37f2 <__wb_calc_thresh+258>: shr $0x2,%rax 0xffffffff811c37f6 <__wb_calc_thresh+262>: mul %rcx 0xffffffff811c37f9 <__wb_calc_thresh+265>: shr $0x2,%rdx 0xffffffff811c37fd <__wb_calc_thresh+269>: mov %rdx,%r10
This series uses div64_ul() instead of div_u64() if the divisor is unsigned long, to avoid truncation to 32-bit on 64-bit platforms.
This patch (of 3):
The variables 'min' and 'max' are unsigned long and do_div truncates them to 32 bits, which means it can test non-zero and be truncated to zero for division. Fix this issue by using div64_ul() instead.
--- mm/page-writeback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/page-writeback.c +2 -2
@@ -200,11 +200,11 @@ static void wb_min_max_ratio(struct bdi_if (this_bw < tot_bw) {if (min) { min *= this_bw; -do_div (min, tot_bw); + min =div64_ul (min, tot_bw); }if (max <100 ) { max *= this_bw; -do_div (max, tot_bw); + max =div64_ul (max, tot_bw); } }
Greg Kroah-Hartman
maintainerPATCH 54/76 net: stmmac: Enable 16KB buffer size
In reply to Greg Kroah-HartmanFrom: Jose Abreu <[email protected]>
commit b2f3a481c4cd62f78391b836b64c0a6e72b503d2 upstream.
XGMAC supports maximum MTU that can go to 16KB. Lets add this check in the calculation of RX buffer size.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -1
@@ -935,7 +935,9 @@ static int stmmac_set_bfsize(int mtu, in {int ret = bufsize; -if (mtu >= BUF_SIZE_4KiB) +if (mtu >= BUF_SIZE_8KiB) + ret = BUF_SIZE_16KiB; +else if (mtu >= BUF_SIZE_4KiB) ret = BUF_SIZE_8KiB;else if (mtu >= BUF_SIZE_2KiB) ret = BUF_SIZE_4KiB;
Greg Kroah-Hartman
maintainerPATCH 55/76 USB: serial: io_edgeport: use irqsave() in USBs complete callback
In reply to Greg Kroah-HartmanFrom: John Ogness <[email protected]>
[ Upstream commit dd1fae527612543e560e84f2eba4f6ef2006ac55 ]
The USB completion callback does not disable interrupts while acquiring the lock. We want to remove the local_irq_disable() invocation from __usb_hcd_giveback_urb() and therefore it is required for the callback handler to disable the interrupts while acquiring the lock. The callback may be invoked either in IRQ or BH context depending on the USB host controller.
Use the _irqsave() variant of the locking primitives.
--- drivers/usb/serial/io_edgeport.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/usb/serial/io_edgeport.c +11 -6
@@ -572,6 +572,7 @@ static void edge_interrupt_callback(struct urb *urb)struct usb_serial_port *port;unsigned char *data = urb->transfer_buffer;int length = urb->actual_length; +unsigned long flags;int bytes_avail;int position;int txCredits;
@@ -603,7 +604,7 @@ static void edge_interrupt_callback(struct urb *urb)if (length >1 ) { bytes_avail = data[0 ] | (data[1 ] <<8 );if (bytes_avail) { -spin_lock (&edge_serial->es_lock); +spin_lock_irqsave (&edge_serial->es_lock, flags); edge_serial->rxBytesAvail += bytes_avail; dev_dbg(dev, "%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n",
@@ -626,7 +627,8 @@ static void edge_interrupt_callback(struct urb *urb) edge_serial->read_in_progress = false; } } -spin_unlock (&edge_serial->es_lock); +spin_unlock_irqrestore (&edge_serial->es_lock, + flags); } }/* grab the txcredits for the ports if available */
@@ -639,9 +641,11 @@ static void edge_interrupt_callback(struct urb *urb) port = edge_serial->serial->port[portNumber]; edge_port =usb_get_serial_port_data (port);if (edge_port->open) { -spin_lock (&edge_port->ep_lock); +spin_lock_irqsave (&edge_port->ep_lock, + flags); edge_port->txCredits += txCredits; -spin_unlock (&edge_port->ep_lock); +spin_unlock_irqrestore (&edge_port->ep_lock, + flags);dev_dbg (dev,"%s - txcredits for port%d = %d\n" , __func__, portNumber, edge_port->txCredits);
@@ -682,6 +686,7 @@ static void edge_bulk_in_callback(struct urb *urb)int retval;__u16 raw_data_length;int status = urb->status; +unsigned long flags;if (status) { dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n",
@@ -701,7 +706,7 @@ static void edge_bulk_in_callback(struct urb *urb)usb_serial_debug_data (dev, __func__, raw_data_length, data); -spin_lock (&edge_serial->es_lock); +spin_lock_irqsave (&edge_serial->es_lock, flags);/* decrement our rxBytes available by the number that we just got */ edge_serial->rxBytesAvail -= raw_data_length;
@@ -725,7 +730,7 @@ static void edge_bulk_in_callback(struct urb *urb) edge_serial->read_in_progress = false; } -spin_unlock (&edge_serial->es_lock); +spin_unlock_irqrestore (&edge_serial->es_lock, flags); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/76 USB: serial: io_edgeport: handle unbound ports on URB completion
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit e37d1aeda737a20b1846a91a3da3f8b0f00cf690 ]
Check for NULL port data in the shared interrupt and bulk completion callbacks to avoid dereferencing a NULL pointer in case a device sends data for a port device which isn't bound to a driver (e.g. due to a malicious device having unexpected endpoints or after an allocation failure on port probe).
--- drivers/usb/serial/io_edgeport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/serial/io_edgeport.c +2 -2
@@ -640,7 +640,7 @@ static void edge_interrupt_callback(struct urb *urb)if (txCredits) { port = edge_serial->serial->port[portNumber]; edge_port =usb_get_serial_port_data (port); -if (edge_port->open) { +if (edge_port && edge_port->open) {spin_lock_irqsave (&edge_port->ep_lock, flags); edge_port->txCredits += txCredits;
@@ -1780,7 +1780,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,if (rxLen && edge_serial->rxPort < serial->num_ports) { port = serial->port[edge_serial->rxPort]; edge_port =usb_get_serial_port_data (port); -if (edge_port->open) { +if (edge_port && edge_port->open) {dev_dbg (dev,"%s - Sending %d bytes to TTY for port %d\n" , __func__, rxLen, edge_serial->rxPort);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 57/76 USB: serial: keyspan: handle unbound ports
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 3018dd3fa114b13261e9599ddb5656ef97a1fa17 ]
Check for NULL port data in the control URB completion handlers to avoid dereferencing a NULL pointer in the unlikely case where a port device isn't bound to a driver (e.g. after an allocation failure on port probe()).
--- drivers/usb/serial/keyspan.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/keyspan.c +4 -0
@@ -565,6 +565,8 @@ static void usa49_glocont_callback(struct urb *urb)for (i =0 ; i < serial->num_ports; ++i) { port = serial->port[i]; p_priv =usb_get_serial_port_data (port); +if (!p_priv) +continue ;if (p_priv->resend_cont) {dev_dbg (&port->dev,"%s - sending setup\n" , __func__);
@@ -962,6 +964,8 @@ static void usa67_glocont_callback(struct urb *urb)for (i =0 ; i < serial->num_ports; ++i) { port = serial->port[i]; p_priv =usb_get_serial_port_data (port); +if (!p_priv) +continue ;if (p_priv->resend_cont) {dev_dbg (&port->dev,"%s - sending setup\n" , __func__);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 58/76 scsi: fnic: use kernels %pM format option to print MAC
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 36fe90b0f0bdc9d030e88ba2153f3c8d6b6a5964 ]
Instead of supplying each byte through stack let's use %pM specifier.
--- drivers/scsi/fnic/vnic_dev.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/scsi/fnic/vnic_dev.c +2 -8
@@ -499,10 +499,7 @@ void vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr) err =vnic_dev_cmd (vdev,CMD_ADDR_ADD , &a0, &a1, wait);if (err) -printk (KERN_ERR -"Can't add addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n" , - addr[0 ], addr[1 ], addr[2 ], addr[3 ], addr[4 ], addr[5 ], - err); +pr_err ("Can't add addr [%pM], %d\n" , addr, err); }void vnic_dev_del_addr (struct vnic_dev *vdev,u8 *addr)
@@ -517,10 +514,7 @@ void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr) err =vnic_dev_cmd (vdev,CMD_ADDR_DEL , &a0, &a1, wait);if (err) -printk (KERN_ERR -"Can't del addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n" , - addr[0 ], addr[1 ], addr[2 ], addr[3 ], addr[4 ], addr[5 ], - err); +pr_err ("Can't del addr [%pM], %d\n" , addr, err); }int vnic_dev_notify_set (struct vnic_dev *vdev,u16 intr)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 59/76 scsi: fnic: fix invalid stack access
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 42ec15ceaea74b5f7a621fc6686cbf69ca66c4cf ]
gcc -O3 warns that some local variables are not properly initialized:
drivers/scsi/fnic/vnic_dev.c: In function 'fnic_dev_hang_notify':drivers/scsi/fnic/vnic_dev.c:511:16: error: 'a0' is used uninitialized in this function [-Werror=uninitialized]
vdev->args[0] = *a0;
~~~~~~~~~~~~~~^~~~~drivers/scsi/fnic/vnic_dev.c:691:6: note: 'a0' was declared here
u64 a0, a1;
^~drivers/scsi/fnic/vnic_dev.c:512:16: error: 'a1' is used uninitialized in this function [-Werror=uninitialized]
vdev->args[1] = *a1;
~~~~~~~~~~~~~~^~~~~drivers/scsi/fnic/vnic_dev.c:691:10: note: 'a1' was declared here
u64 a0, a1;
^~drivers/scsi/fnic/vnic_dev.c: In function 'fnic_dev_mac_addr':drivers/scsi/fnic/vnic_dev.c:512:16: error: 'a1' is used uninitialized in this function [-Werror=uninitialized]
vdev->args[1] = *a1;
~~~~~~~~~~~~~~^~~~~drivers/scsi/fnic/vnic_dev.c:698:10: note: 'a1' was declared here
u64 a0, a1;
^~Apparently the code relies on the local variables occupying adjacent memory locations in the same order, but this is of course not guaranteed.
Use an array of two u64 variables where needed to make it work correctly.
I suspect there is also an endianness bug here, but have not digged in deep enough to be sure.
--- drivers/scsi/fnic/vnic_dev.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/scsi/fnic/vnic_dev.c +10 -10
@@ -445,26 +445,26 @@ int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done)int vnic_dev_hang_notify (struct vnic_dev *vdev) { -u64 a0, a1; +u64 a0 =0 , a1 =0 ;int wait =1000 ;return vnic_dev_cmd (vdev,CMD_HANG_NOTIFY , &a0, &a1, wait); }int vnic_dev_mac_addr (struct vnic_dev *vdev,u8 *mac_addr) { -u64 a0, a1; +u64 a[2 ] = {};int wait =1000 ;int err, i;for (i =0 ; i <ETH_ALEN ; i++) mac_addr[i] =0 ; - err =vnic_dev_cmd (vdev,CMD_MAC_ADDR , &a0, &a1, wait); + err =vnic_dev_cmd (vdev,CMD_MAC_ADDR , &a[0 ], &a[1 ], wait);if (err)return err;for (i =0 ; i <ETH_ALEN ; i++) - mac_addr[i] = ((u8 *)&a0)[i]; + mac_addr[i] = ((u8 *)&a)[i];return 0 ; }
@@ -489,30 +489,30 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,void vnic_dev_add_addr (struct vnic_dev *vdev,u8 *addr) { -u64 a0 =0 , a1 =0 ; +u64 a[2 ] = {};int wait =1000 ;int err;int i;for (i =0 ; i <ETH_ALEN ; i++) - ((u8 *)&a0)[i] = addr[i]; + ((u8 *)&a)[i] = addr[i]; - err =vnic_dev_cmd (vdev,CMD_ADDR_ADD , &a0, &a1, wait); + err =vnic_dev_cmd (vdev,CMD_ADDR_ADD , &a[0 ], &a[1 ], wait);if (err)pr_err ("Can't add addr [%pM], %d\n" , addr, err); }void vnic_dev_del_addr (struct vnic_dev *vdev,u8 *addr) { -u64 a0 =0 , a1 =0 ; +u64 a[2 ] = {};int wait =1000 ;int err;int i;for (i =0 ; i <ETH_ALEN ; i++) - ((u8 *)&a0)[i] = addr[i]; + ((u8 *)&a)[i] = addr[i]; - err =vnic_dev_cmd (vdev,CMD_ADDR_DEL , &a0, &a1, wait); + err =vnic_dev_cmd (vdev,CMD_ADDR_DEL , &a[0 ], &a[1 ], wait);if (err)pr_err ("Can't del addr [%pM], %d\n" , addr, err); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/76 media: exynos4-is: Fix recursive locking in isp_video_release()
In reply to Greg Kroah-HartmanFrom: Seung-Woo Kim <[email protected]>
commit 704c6c80fb471d1bb0ef0d61a94617d1d55743cd upstream.
Quoted 1 line
From
isp_video_release(),&isp->video_lockis held and subsequent
vb2_fop_release() tries to lock vdev->lock which is same with the previous one. Replace vb2_fop_release() with _vb2_fop_release() to fix the recursive locking.
--- drivers/media/platform/exynos4-is/fimc-isp-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/exynos4-is/fimc-isp-video.c +1 -1
@@ -323,7 +323,7 @@ static int isp_video_release(struct file ivc->streaming =0 ; } -vb2_fop_release (file); +_vb2_fop_release (file,NULL );if (v4l2_fh_is_singular_file (file)) {fimc_pipeline_call (&ivc->ve, close);
Greg Kroah-Hartman
maintainerPATCH 60/76 arm64: dts: agilex/stratix10: fix pmu interrupt numbers
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
[ Upstream commit 210de0e996aee8e360ccc9e173fe7f0a7ed2f695 ]
Fix up the correct interrupt numbers for the PMU unit on Agilex and Stratix10.
--- arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +4 -4
@@ -56,10 +56,10 @@ pmu { compatible = "arm,armv8-pmuv3"; - interrupts = <0 120 8>, - <0 121 8>, - <0 122 8>, - <0 123 8>; + interrupts = <0 170 4>, + <0 171 4>, + <0 172 4>, + <0 173 4>; interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 61/76 netfilter: fix a use-after-free in mtype_destroy()
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
commit c120959387efa51479056fd01dc90adfba7a590c upstream.
map->members is freed by ip_set_free() right before using it in mtype_ext_cleanup() again. So we just have to move it down.
--- net/netfilter/ipset/ip_set_bitmap_gen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipset/ip_set_bitmap_gen.h +1 -1
@@ -66,9 +66,9 @@ mtype_destroy(struct ip_set *set)if (SET_WITH_TIMEOUT (set))del_timer_sync (&map->gc); -ip_set_free (map->members);if (set->dsize && set->extensions &IPSET_EXT_DESTROY )mtype_ext_cleanup (set); +ip_set_free (map->members);ip_set_free (map); set->data =NULL ;
Greg Kroah-Hartman
maintainerPATCH 62/76 batman-adv: Fix DAT candidate selection on little endian systems
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
commit 4cc4a1708903f404d2ca0dfde30e71e052c6cbc9 upstream.
The distributed arp table is using a DHT to store and retrieve MAC address information for an IP address. This is done using unicast messages to selected peers. The potential peers are looked up using the IP address and the VID.
While the IP address is always stored in big endian byte order, this is not the case of the VID. It can (depending on the host system) either be big endian or little endian. The host must therefore always convert it to big endian to ensure that all devices calculate the same peers for the same lookup data.
--- net/batman-adv/distributed-arp-table.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/batman-adv/distributed-arp-table.c +3 -1
@@ -226,6 +226,7 @@ static u32 batadv_hash_dat(const void *du32 hash =0 ;const struct batadv_dat_entry *dat = data;const unsigned char *key; +__be16 vid;u32 i; key = (const unsigned char *)&dat->ip;
@@ -235,7 +236,8 @@ static u32 batadv_hash_dat(const void *d hash ^= (hash >>6 ); } - key = (const unsigned char *)&dat->vid; + vid =htons (dat->vid); + key = (__force const unsigned char *)&vid;for (i =0 ; i <sizeof (dat->vid); i++) { hash += key[i]; hash += (hash <<10 );
Greg Kroah-Hartman
maintainerPATCH 64/76 r8152: add missing endpoint sanity check
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 86f3f4cd53707ceeec079b83205c8d3c756eca93 ]
Add missing endpoint sanity check to probe in order to prevent a NULL-pointer dereference (or slab out-of-bounds access) when retrieving the interrupt-endpoint bInterval on ndo_open() in case a device lacks the expected endpoints.
--- drivers/net/usb/r8152.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/usb/r8152.c +3 -0
@@ -4243,6 +4243,9 @@ static int rtl8152_probe(struct usb_intereturn -ENODEV ; } +if (intf->cur_altsetting->desc.bNumEndpoints <3 ) +return -ENODEV ; +usb_reset_device (udev); netdev =alloc_etherdev (sizeof (struct r8152 ));if (!netdev) {
Greg Kroah-Hartman
maintainerPATCH 65/76 tcp: fix marked lost packets not being retransmitted
In reply to Greg Kroah-HartmanFrom: Pengcheng Yang <[email protected]>
[ Upstream commit e176b1ba476cf36f723cfcc7a9e57f3cb47dec70 ]
When the packet pointed to by retransmit_skb_hint is unlinked by ACK, retransmit_skb_hint will be set to NULL in tcp_clean_rtx_queue(). If packet loss is detected at this time, retransmit_skb_hint will be set to point to the current packet loss in tcp_verify_retransmit_hint(), then the packets that were previously marked lost but not retransmitted due to the restriction of cwnd will be skipped and cannot be retransmitted.
To fix this, when retransmit_skb_hint is NULL, retransmit_skb_hint can be reset only after all marked lost packets are retransmitted (retrans_out >= lost_out), otherwise we need to traverse from tcp_rtx_queue_head in tcp_xmit_retransmit_queue().
Packetdrill to demonstrate:
// Disable RACK and set max_reordering to keep things simple
0 `sysctl -q net.ipv4.tcp_recovery=0`
+0 sysctl -q net.ipv4.tcp_max_reordering=3
// Establish a connection
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+.1 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 > S. 0:0(0) ack 1 <...>
+.01 < . 1:1(0) ack 1 win 257
+0 accept(3, ..., ...) = 4
// Send 8 data segments
+0 write(4, ..., 8000) = 8000
+0 > P. 1:8001(8000) ack 1
// Enter recovery and 1:3001 is marked lost
+.01 < . 1:1(0) ack 1 win 257 <sack 3001:4001,nop,nop>
+0 < . 1:1(0) ack 1 win 257 <sack 5001:6001 3001:4001,nop,nop> +0 < . 1:1(0) ack 1 win 257 <sack 5001:7001 3001:4001,nop,nop>
// Retransmit 1:1001, now retransmit_skb_hint points to 1001:2001
+0 > . 1:1001(1000) ack 1
// 1001:2001 was ACKed causing retransmit_skb_hint to be set to NULL
+.01 < . 1:1(0) ack 2001 win 257 <sack 5001:8001 3001:4001,nop,nop>
// Now retransmit_skb_hint points to 4001:5001 which is now marked lost
// BUG: 2001:3001 was not retransmitted
+0 > . 2001:3001(1000) ack 1
--- net/ipv4/tcp_input.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/ipv4/tcp_input.c +4 -3
@@ -895,9 +895,10 @@ static void tcp_update_reordering(struct/* This must be called before lost_out is incremented */ static void tcp_verify_retransmit_hint (struct tcp_sock *tp,struct sk_buff *skb) { -if (!tp->retransmit_skb_hint || -before (TCP_SKB_CB (skb)->seq, -TCP_SKB_CB (tp->retransmit_skb_hint)->seq)) +if ((!tp->retransmit_skb_hint && tp->retrans_out >= tp->lost_out) || + (tp->retransmit_skb_hint && +before (TCP_SKB_CB (skb)->seq, +TCP_SKB_CB (tp->retransmit_skb_hint)->seq))) tp->retransmit_skb_hint = skb; if (!tp->lost_out ||
Greg Kroah-Hartman
maintainerPATCH 66/76 net: usb: lan78xx: limit size of local TSO packets
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit f8d7408a4d7f60f8b2df0f81decdc882dd9c20dc ]
lan78xx_tx_bh() makes sure to not exceed MAX_SINGLE_PACKET_SIZE bytes in the aggregated packets it builds, but does nothing to prevent large GSO packets being submitted.
Pierre-Francois reported various hangs when/if TSO is enabled.
For localy generated packets, we can use netif_set_gso_max_size() to limit the size of TSO packets.
Note that forwarded packets could still hit the issue, so a complete fix might require implementing .ndo_features_check for this driver, forcing a software segmentation if the size of the TSO packet exceeds MAX_SINGLE_PACKET_SIZE.
--- drivers/net/usb/lan78xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/lan78xx.c +1 -0
@@ -2961,6 +2961,7 @@ static int lan78xx_probe(struct usb_inteif (netdev->mtu > (dev->hard_mtu - netdev->hard_header_len)) netdev->mtu = dev->hard_mtu - netdev->hard_header_len; +netif_set_gso_max_size (netdev,MAX_SINGLE_PACKET_SIZE -MAX_HEADER ); dev->ep_blkin = (intf->cur_altsetting)->endpoint +0 ; dev->ep_blkout = (intf->cur_altsetting)->endpoint +1 ;
Greg Kroah-Hartman
maintainerPATCH 67/76 xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 589b72894f53124a39d1bb3c0cecaf9dcabac417 upstream.
Clang warns:
../drivers/block/xen-blkfront.c:1117:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
nr_parts = PARTS_PER_DISK;
^
../drivers/block/xen-blkfront.c:1115:3: note: previous statement is here
if (err)
^This is because there is a space at the beginning of this line; remove it so that the indentation is consistent according to the Linux kernel coding style and clang no longer warns.
While we are here, the previous line has some trailing whitespace; clean that up as well.
--- drivers/block/xen-blkfront.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/xen-blkfront.c +2 -2
@@ -952,8 +952,8 @@ static int xlvbd_alloc_gendisk(blkif_secif (!VDEV_IS_EXTENDED (info->vdevice)) { err =xen_translate_vdev (info->vdevice, &minor, &offset);if (err) -return err; - nr_parts =PARTS_PER_DISK ; +return err; + nr_parts =PARTS_PER_DISK ; }else { minor =BLKIF_MINOR_EXT (info->vdevice); nr_parts =PARTS_PER_EXT_DISK ;
Greg Kroah-Hartman
maintainerPATCH 68/76 cw1200: Fix a signedness bug in cw1200_load_firmware()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 4a50d454502f1401171ff061a5424583f91266db upstream.
The "priv->hw_type" is an enum and in this context GCC will treat it as an unsigned int so the error handling will never trigger.
--- drivers/net/wireless/cw1200/fwio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/cw1200/fwio.c +3 -3
@@ -323,12 +323,12 @@ int cw1200_load_firmware(struct cw1200_c goto out; } - priv->hw_type =cw1200_get_hw_type (val32, &major_revision); -if (priv->hw_type <0 ) { + ret =cw1200_get_hw_type (val32, &major_revision); +if (ret <0 ) {pr_err ("Can't deduce hardware type.\n" ); - ret = -ENOTSUPP ; goto out; } + priv->hw_type = ret;/* Set DPLL Reg value, and read back to confirm writes work */ ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID,
Greg Kroah-Hartman
maintainerPATCH 34/76 spi: atmel: fix handling of cs_change set on non-last xfer
In reply to Greg Kroah-HartmanFrom: Mans Rullgard <[email protected]>
commit fed8d8c7a6dc2a76d7764842853d81c770b0788e upstream.
The driver does the wrong thing when cs_change is set on a non-last xfer in a message. When cs_change is set, the driver deactivates the CS and leaves it off until a later xfer again has cs_change set whereas it should be briefly toggling CS off and on again.
This patch brings the behaviour of the driver back in line with the documentation and common sense. The delay of 10 us is the same as is used by the default spi_transfer_one_message() function in spi.c.
--- drivers/spi/spi-atmel.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/spi/spi-atmel.c +3 -7
@@ -315,7 +315,6 @@ struct atmel_spi {struct atmel_spi_dma dma;bool keep_cs; -bool cs_active;u32 fifo_size; };
@@ -1404,11 +1403,9 @@ static int atmel_spi_one_transfer(struct &msg->transfers)) { as->keep_cs = true; }else { - as->cs_active = !as->cs_active; -if (as->cs_active) -cs_activate (as, msg->spi); -else -cs_deactivate (as, msg->spi); +cs_deactivate (as, msg->spi); +udelay (10 ); +cs_activate (as, msg->spi); } }
@@ -1431,7 +1428,6 @@ static int atmel_spi_transfer_one_messagatmel_spi_lock (as);cs_activate (as, spi); - as->cs_active = true; as->keep_cs = false; msg->status =0 ;
Greg Kroah-Hartman
maintainerPATCH 35/76 rtlwifi: Remove unnecessary NULL check in rtl_regd_init
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 091c6e9c083f7ebaff00b37ad13562d51464d175 upstream.
When building with Clang + -Wtautological-pointer-compare:
drivers/net/wireless/realtek/rtlwifi/regd.c:389:33: warning: comparison of address of 'rtlpriv->regd' equal to a null pointer is always false [-Wtautological-pointer-compare]
if (wiphy == NULL || &rtlpriv->regd == NULL)
~~~~~~~~~^~~~ ~~~~1 warning generated.
The address of an array member is never NULL unless it is the first struct member so remove the unnecessary check. This was addressed in the staging version of the driver in commit f986978b32b3 ("Staging:
rtlwifi: remove unnecessary NULL check").
While we are here, fix the following checkpatch warning:
CHECK: Comparison to NULL could be written "!wiphy" 35: FILE: drivers/net/wireless/realtek/rtlwifi/regd.c:389:
+ if (wiphy == NULL)
--- drivers/net/wireless/realtek/rtlwifi/regd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/regd.c +1 -1
@@ -427,7 +427,7 @@ int rtl_regd_init(struct ieee80211_hw *hstruct wiphy *wiphy = hw->wiphy;struct country_code_to_enum_rd *country =NULL ; -if (wiphy ==NULL || &rtlpriv->regd ==NULL ) +if (!wiphy)return -EINVAL ;/* init country_code from efuse channel plan */
Greg Kroah-Hartman
maintainerPATCH 36/76 rtc: msm6242: Fix reading of 10-hour digit
In reply to Greg Kroah-HartmanFrom: Kars de Jong <[email protected]>
commit e34494c8df0cd96fc432efae121db3212c46ae48 upstream.
The driver was reading the wrong register as the 10-hour digit due to a misplaced ')'. It was in fact reading the 1-second digit register due to this bug.
Also remove the use of a magic number for the hour mask and use the define for it which was already present.
--- drivers/rtc/rtc-msm6242.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/rtc/rtc-msm6242.c +2 -1
@@ -132,7 +132,8 @@ static int msm6242_read_time(struct devimsm6242_read (priv,MSM6242_SECOND1 ); tm->tm_min =msm6242_read (priv,MSM6242_MINUTE10 ) *10 +msm6242_read (priv,MSM6242_MINUTE1 ); - tm->tm_hour = (msm6242_read (priv,MSM6242_HOUR10 &3 )) *10 + + tm->tm_hour = (msm6242_read (priv,MSM6242_HOUR10 ) & +MSM6242_HOUR10_HR_MASK ) *10 +msm6242_read (priv,MSM6242_HOUR1 ); tm->tm_mday =msm6242_read (priv,MSM6242_DAY10 ) *10 +msm6242_read (priv,MSM6242_DAY1 );
Greg Kroah-Hartman
maintainerPATCH 37/76 rseq/selftests: Turn off timeout setting
In reply to Greg Kroah-HartmanFrom: Mathieu Desnoyers <[email protected]>
[ Upstream commit af9cb29c5488381083b0b5ccdfb3cd931063384a ]
As the rseq selftests can run for a long period of time, disable the timeout that the general selftests have.
--- tools/testing/selftests/rseq/settings | 1 + 1 file changed, 1 insertion(+) create mode 100644 tools/testing/selftests/rseq/settings
tools/testing/selftests/rseq/settings new file +1 -0
@@ -0,0 +1 @@ +timeout=0
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 38/76 hexagon: work around compiler crash
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
[ Upstream commit 63e80314ab7cf4783526d2e44ee57a90514911c9 ]
Clang cannot translate the string "r30" into a valid register yet.
--- arch/hexagon/kernel/stacktrace.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/hexagon/kernel/stacktrace.c +1 -3
@@ -23,8 +23,6 @@#include <linux/thread_info.h> #include <linux/module.h> -registerunsigned long current_frame_pointer asm("r30" ); -struct stackframe {unsigned long fp;unsigned long rets;
@@ -42,7 +40,7 @@ void save_stack_trace(struct stack_trace *trace) low = (unsigned long )task_stack_page (current); high = low +THREAD_SIZE ; - fp = current_frame_pointer; + fp = (unsigned long )__builtin_frame_address (0 );while (fp >= low && fp <= (high -sizeof (*frame))) { frame = (struct stackframe *)fp;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 30/76 compat_ioctl: handle SIOCOUTQNSD
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 9d7bf41fafa5b5ddd4c13eb39446b0045f0a8167 upstream.
Unlike the normal SIOCOUTQ, SIOCOUTQNSD was never handled in compat mode. Add it to the common socket compat handler along with similar ones.
--- net/socket.c | 1 + 1 file changed, 1 insertion(+)
net/socket.c +1 -0
@@ -3143,6 +3143,7 @@ static int compat_sock_ioctl_trans(struccase SIOCSARP :case SIOCGARP :case SIOCDARP : +case SIOCOUTQNSD :case SIOCATMARK :return sock_do_ioctl (net, sock, cmd, arg); }
Greg Kroah-Hartman
maintainerPATCH 39/76 ocfs2: call journal flush to mark journal as empty after journal recovery when mount
In reply to Greg Kroah-HartmanFrom: Kai Li <[email protected]>
[ Upstream commit 397eac17f86f404f5ba31d8c3e39ec3124b39fd3 ]
If journal is dirty when mount, it will be replayed but jbd2 sb log tail cannot be updated to mark a new start because journal->j_flag has already been set with JBD2_ABORT first in journal_init_common.
When a new transaction is committed, it will be recored in block 1 first(journal->j_tail is set to 1 in journal_reset). If emergency restart happens again before journal super block is updated unfortunately, the new recorded trans will not be replayed in the next mount.
The following steps describe this procedure in detail.
1. mount and touch some files
2. these transactions are committed to journal area but not checkpointed
3. emergency restart
4. mount again and its journals are replayed
5. journal super block's first s_start is 1, but its s_seq is not updated
6. touch a new file and its trans is committed but not checkpointed
7. emergency restart again
8. mount and journal is dirty, but trans committed in 6 will not be replayed.
This exception happens easily when this lun is used by only one node. If it is used by multi-nodes, other node will replay its journal and its journal super block will be updated after recovery like what this patch does.
ocfs2_recover_node->ocfs2_replay_journal.
The following jbd2 journal can be generated by touching a new file after journal is replayed, and seq 15 is the first valid commit, but first seq is 13 in journal super block.
logdump:
Block 0: Journal Superblock
Seq: 0 Type: 4 (JBD2_SUPERBLOCK_V2)
Blocksize: 4096 Total Blocks: 32768 First Block: 1
First Commit ID: 13 Start Log Blknum: 1
Error: 0
Feature Compat: 0
Feature Incompat: 2 block64
Feature RO compat: 0
Journal UUID: 4ED3822C54294467A4F8E87D2BA4BC36
FS Share Cnt: 1 Dynamic Superblk Blknum: 0
Per Txn Block Limit Journal: 0 Data: 0
Block 1: Journal Commit Block
Seq: 14 Type: 2 (JBD2_COMMIT_BLOCK)
Block 2: Journal Descriptor
Seq: 15 Type: 1 (JBD2_DESCRIPTOR_BLOCK)
No. Blocknum Flags
0. 587 none
UUID: 00000000000000000000000000000000
1. 8257792 JBD2_FLAG_SAME_UUID 2. 619 JBD2_FLAG_SAME_UUID 3. 24772864 JBD2_FLAG_SAME_UUID 4. 8257802 JBD2_FLAG_SAME_UUID 5. 513 JBD2_FLAG_SAME_UUID JBD2_FLAG_LAST_TAG ... Block 7: Inode Inode: 8257802 Mode: 0640 Generation: 57157641 (0x3682809) FS Generation: 2839773110 (0xa9437fb6) CRC32: 00000000 ECC: 0000 Type: Regular Attr: 0x0 Flags: Valid Dynamic Features: (0x1) InlineData User: 0 (root) Group: 0 (root) Size: 7 Links: 1 Clusters: 0 ctime: 0x5de5d870 0x11104c61 -- Tue Dec 3 11:37:20.286280801 2019 atime: 0x5de5d870 0x113181a1 -- Tue Dec 3 11:37:20.288457121 2019 mtime: 0x5de5d870 0x11104c61 -- Tue Dec 3 11:37:20.286280801 2019
dtime: 0x0 -- Thu Jan 1 08:00:00 1970
...
Block 9: Journal Commit Block
Seq: 15 Type: 2 (JBD2_COMMIT_BLOCK)
The following is journal recovery log when recovering the upper jbd2 journal when mount again.
syslog:
ocfs2: File system on device (252,1) was not unmounted cleanly, recovering it. fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 0 fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 1 fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 2 fs/jbd2/recovery.c:(jbd2_journal_recover, 278): JBD2: recovery, exit status 0, recovered transactions 13 to 13
Due to first commit seq 13 recorded in journal super is not consistent with the value recorded in block 1(seq is 14), journal recovery will be terminated before seq 15 even though it is an unbroken commit, inode 8257802 is a new file and it will be lost.
--- fs/ocfs2/journal.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ocfs2/journal.c +8 -0
@@ -1080,6 +1080,14 @@ int ocfs2_journal_load(struct ocfs2_jourocfs2_clear_journal_error (osb->sb, journal->j_journal, osb->slot_num); +if (replayed) { +jbd2_journal_lock_updates (journal->j_journal); + status =jbd2_journal_flush (journal->j_journal); +jbd2_journal_unlock_updates (journal->j_journal); +if (status <0 ) +mlog_errno (status); + } + status =ocfs2_journal_toggle_dirty (osb,1 , replayed);if (status <0 ) {mlog_errno (status);
Greg Kroah-Hartman
maintainerPATCH 71/76 scsi: qla4xxx: fix double free bug
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
commit 3fe3d2428b62822b7b030577cd612790bdd8c941 upstream.
The variable init_fw_cb is released twice, resulting in a double free bug. The call to the function dma_free_coherent() before goto is removed to get rid of potential double free.
--- drivers/scsi/qla4xxx/ql4_mbx.c | 3 --- 1 file changed, 3 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +0 -3
@@ -641,9 +641,6 @@ int qla4xxx_initialize_fw_cb(struct scsiif (qla4xxx_get_ifcb (ha, &mbox_cmd[0 ], &mbox_sts[0 ], init_fw_cb_dma) !=QLA_SUCCESS ) { -dma_free_coherent (&ha->pdev->dev, -sizeof (struct addr_ctrl_blk ), - init_fw_cb, init_fw_cb_dma); goto exit_init_fw_cb; }
Greg Kroah-Hartman
maintainerPATCH 73/76 scsi: target: core: Fix a pr_debug() argument
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
commit c941e0d172605731de9b4628bd4146d35cf2e7d6 upstream.
Print the string for which conversion failed instead of printing the function name twice.
--- drivers/target/target_core_fabric_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_fabric_lib.c +1 -1
@@ -130,7 +130,7 @@ static int srp_get_pr_transport_id(memset (buf +8 ,0 , leading_zero_bytes); rc =hex2bin (buf +8 + leading_zero_bytes, p, count);if (rc <0 ) { -pr_debug ("hex2bin failed for %s: %d\n" , __func__, rc); +pr_debug ("hex2bin failed for %s: %d\n" , p, rc);return rc; }
Greg Kroah-Hartman
maintainerPATCH 74/76 scsi: core: scsi_trace: Use get_unaligned_be*()
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
commit b1335f5b0486f61fb66b123b40f8e7a98e49605d upstream.
This patch fixes an unintended sign extension on left shifts. From Colin
King: "Shifting a u8 left will cause the value to be promoted to an integer. If the top bit of the u8 is set then the following conversion to an u64 will sign extend the value causing the upper 32 bits to be set in the result."
Fix this by using get_unaligned_be*() instead.
--- drivers/scsi/scsi_trace.c | 104 ++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 75 deletions(-)
drivers/scsi/scsi_trace.c +29 -75
@@ -17,10 +17,11 @@*/ #include <linux/kernel.h> #include <linux/trace_seq.h> +#include <asm/unaligned.h> #include <trace/events/scsi.h> #define SERVICE_ACTION16 (cdb) (cdb[1] & 0x1f) -#define SERVICE_ACTION32 (cdb) ((cdb[8] << 8) | cdb[9]) +#define SERVICE_ACTION32 (cdb) (get_unaligned_be16(&cdb[8]))static const char *scsi_trace_misc (struct trace_seq *,unsigned char *,int );
@@ -50,17 +51,12 @@ static const char * scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) { const char *ret = trace_seq_buffer_ptr(p); -sector_t lba =0 , txlen =0 ; +u32 lba, txlen; - lba |= (cdb[2 ] <<24 ); - lba |= (cdb[3 ] <<16 ); - lba |= (cdb[4 ] <<8 ); - lba |= cdb[5 ]; - txlen |= (cdb[7 ] <<8 ); - txlen |= cdb[8 ]; + lba =get_unaligned_be32 (&cdb[2 ]); + txlen =get_unaligned_be16 (&cdb[7 ]); -trace_seq_printf (p,"lba=%llu txlen=%llu protect=%u" , - (unsigned long long )lba, (unsigned long long )txlen, +trace_seq_printf (p,"lba=%u txlen=%u protect=%u" , lba, txlen, cdb[1 ] >>5 );if (cdb[0 ] ==WRITE_SAME )
@@ -75,19 +71,12 @@ static const char * scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) { const char *ret = trace_seq_buffer_ptr(p); -sector_t lba =0 , txlen =0 ; +u32 lba, txlen; - lba |= (cdb[2 ] <<24 ); - lba |= (cdb[3 ] <<16 ); - lba |= (cdb[4 ] <<8 ); - lba |= cdb[5 ]; - txlen |= (cdb[6 ] <<24 ); - txlen |= (cdb[7 ] <<16 ); - txlen |= (cdb[8 ] <<8 ); - txlen |= cdb[9 ]; + lba =get_unaligned_be32 (&cdb[2 ]); + txlen =get_unaligned_be32 (&cdb[6 ]); -trace_seq_printf (p,"lba=%llu txlen=%llu protect=%u" , - (unsigned long long )lba, (unsigned long long )txlen, +trace_seq_printf (p,"lba=%u txlen=%u protect=%u" , lba, txlen, cdb[1 ] >>5 );trace_seq_putc (p,0 );
@@ -98,23 +87,13 @@ static const char * scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) { const char *ret = trace_seq_buffer_ptr(p); -sector_t lba =0 , txlen =0 ; +u64 lba; +u32 txlen; - lba |= ((u64 )cdb[2 ] <<56 ); - lba |= ((u64 )cdb[3 ] <<48 ); - lba |= ((u64 )cdb[4 ] <<40 ); - lba |= ((u64 )cdb[5 ] <<32 ); - lba |= (cdb[6 ] <<24 ); - lba |= (cdb[7 ] <<16 ); - lba |= (cdb[8 ] <<8 ); - lba |= cdb[9 ]; - txlen |= (cdb[10 ] <<24 ); - txlen |= (cdb[11 ] <<16 ); - txlen |= (cdb[12 ] <<8 ); - txlen |= cdb[13 ]; + lba =get_unaligned_be64 (&cdb[2 ]); + txlen =get_unaligned_be32 (&cdb[10 ]); -trace_seq_printf (p,"lba=%llu txlen=%llu protect=%u" , - (unsigned long long )lba, (unsigned long long )txlen, +trace_seq_printf (p,"lba=%llu txlen=%u protect=%u" , lba, txlen, cdb[1 ] >>5 );if (cdb[0 ] ==WRITE_SAME_16 )
@@ -129,8 +108,8 @@ static const char * scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) { const char *ret = trace_seq_buffer_ptr(p), *cmd; -sector_t lba =0 , txlen =0 ; -u32 ei_lbrt =0 ; +u64 lba; +u32 ei_lbrt, txlen;switch (SERVICE_ACTION32 (cdb)) {case READ_32 :
@@ -150,26 +129,12 @@ scsi_trace_rw32(struct trace_seq *p, uns goto out; } - lba |= ((u64 )cdb[12 ] <<56 ); - lba |= ((u64 )cdb[13 ] <<48 ); - lba |= ((u64 )cdb[14 ] <<40 ); - lba |= ((u64 )cdb[15 ] <<32 ); - lba |= (cdb[16 ] <<24 ); - lba |= (cdb[17 ] <<16 ); - lba |= (cdb[18 ] <<8 ); - lba |= cdb[19 ]; - ei_lbrt |= (cdb[20 ] <<24 ); - ei_lbrt |= (cdb[21 ] <<16 ); - ei_lbrt |= (cdb[22 ] <<8 ); - ei_lbrt |= cdb[23 ]; - txlen |= (cdb[28 ] <<24 ); - txlen |= (cdb[29 ] <<16 ); - txlen |= (cdb[30 ] <<8 ); - txlen |= cdb[31 ]; - -trace_seq_printf (p,"%s_32 lba=%llu txlen=%llu protect=%u ei_lbrt=%u" , - cmd, (unsigned long long )lba, - (unsigned long long )txlen, cdb[10 ] >>5 , ei_lbrt); + lba =get_unaligned_be64 (&cdb[12 ]); + ei_lbrt =get_unaligned_be32 (&cdb[20 ]); + txlen =get_unaligned_be32 (&cdb[28 ]); + +trace_seq_printf (p,"%s_32 lba=%llu txlen=%u protect=%u ei_lbrt=%u" , + cmd, lba, txlen, cdb[10 ] >>5 , ei_lbrt);if (SERVICE_ACTION32 (cdb) ==WRITE_SAME_32 )trace_seq_printf (p," unmap=%u" , cdb[10 ] >>3 &1 );
@@ -184,7 +149,7 @@ static const char * scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len) { const char *ret = trace_seq_buffer_ptr(p); -unsigned int regions = cdb[7 ] <<8 | cdb[8 ]; +unsigned int regions =get_unaligned_be16 (&cdb[7 ]);trace_seq_printf (p,"regions=%u" , (regions -8 ) /16 );trace_seq_putc (p,0 );
@@ -196,8 +161,8 @@ static const char * scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) { const char *ret = trace_seq_buffer_ptr(p), *cmd; -sector_t lba =0 ; -u32 alloc_len =0 ; +u64 lba; +u32 alloc_len;switch (SERVICE_ACTION16 (cdb)) {case SAI_READ_CAPACITY_16 :
@@ -211,21 +176,10 @@ scsi_trace_service_action_in(struct trac goto out; } - lba |= ((u64 )cdb[2 ] <<56 ); - lba |= ((u64 )cdb[3 ] <<48 ); - lba |= ((u64 )cdb[4 ] <<40 ); - lba |= ((u64 )cdb[5 ] <<32 ); - lba |= (cdb[6 ] <<24 ); - lba |= (cdb[7 ] <<16 ); - lba |= (cdb[8 ] <<8 ); - lba |= cdb[9 ]; - alloc_len |= (cdb[10 ] <<24 ); - alloc_len |= (cdb[11 ] <<16 ); - alloc_len |= (cdb[12 ] <<8 ); - alloc_len |= cdb[13 ]; + lba =get_unaligned_be64 (&cdb[2 ]); + alloc_len =get_unaligned_be32 (&cdb[10 ]); -trace_seq_printf (p,"%s lba=%llu alloc_len=%u" , cmd, - (unsigned long long )lba, alloc_len); +trace_seq_printf (p,"%s lba=%llu alloc_len=%u" , cmd, lba, alloc_len); out:trace_seq_putc (p,0 );
Greg Kroah-Hartman
maintainerPATCH 76/76 regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
commit 458ea3ad033fc86e291712ce50cbe60c3428cf30 upstream.
Those regulators are not actually supported by the AB8500 regulator driver. There is no ab8500_regulator_info for them and no entry in ab8505_regulator_match.
As such, they cannot be registered successfully, and looking them up in ab8505_regulator_match causes an out-of-bounds array read.
--- include/linux/regulator/ab8500.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/regulator/ab8500.h +0 -2
@@ -44,8 +44,6 @@ enum ab8505_regulator_id {AB8505_LDO_ANAMIC2 ,AB8505_LDO_AUX8 ,AB8505_LDO_ANA , -AB8505_SYSCLKREQ_2 , -AB8505_SYSCLKREQ_4 , AB8505_NUM_REGULATORS, };
Greg Kroah-Hartman
maintainerPATCH 70/76 scsi: esas2r: unlock on error in esas2r_nvram_read_direct()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 906ca6353ac09696c1bf0892513c8edffff5e0a6 upstream.
This error path is missing an unlock.
--- drivers/scsi/esas2r/esas2r_flash.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/esas2r/esas2r_flash.c +1 -0
@@ -1197,6 +1197,7 @@ bool esas2r_nvram_read_direct(struct esaif (!esas2r_read_flash_block (a, a->nvram,FLS_OFFSET_NVR ,sizeof (struct esas2r_sas_nvram ))) {esas2r_hdebug ("NVRAM read failed, using defaults" ); +up (&a->nvram_semaphore);return false; }
Greg Kroah-Hartman
maintainerPATCH 75/76 perf probe: Fix wrong address verification
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
commit 07d369857808b7e8e471bbbbb0074a6718f89b31 upstream.
Since there are some DIE which has only ranges instead of the combination of entrypc/highpc, address verification must use dwarf_haspc() instead of dwarf_entrypc/dwarf_highpc.
Also, the ranges only DIE will have a partial code in different section (e.g. unlikely code will be in text.unlikely as "FUNC.cold" symbol). In that case, we can not use dwarf_entrypc() or die_entrypc(), because the offset from original DIE can be a minus value.
Instead, this simply gets the symbol and offset from symtab.
Without this patch;
# perf probe -D clear_tasks_mm_cpumask:1
Failed to get entry address of clear_tasks_mm_cpumask
Error: Failed to add events.And with this patch:
# perf probe -D clear_tasks_mm_cpumask:1 p:probe/clear_tasks_mm_cpumask clear_tasks_mm_cpumask+0 p:probe/clear_tasks_mm_cpumask_1 clear_tasks_mm_cpumask+5 p:probe/clear_tasks_mm_cpumask_2 clear_tasks_mm_cpumask+8 p:probe/clear_tasks_mm_cpumask_3 clear_tasks_mm_cpumask+16 p:probe/clear_tasks_mm_cpumask_4 clear_tasks_mm_cpumask+82
Committer testing:
I managed to reproduce the above:
[root@quaco ~]# perf probe -D clear_tasks_mm_cpumask:1 p:probe/clear_tasks_mm_cpumask _text+919968 p:probe/clear_tasks_mm_cpumask_1 _text+919973 p:probe/clear_tasks_mm_cpumask_2 _text+919976 [root@quaco ~]#
But then when trying to actually put the probe in place, it fails if I use :0 as the offset:
[root@quaco ~]# perf probe -L clear_tasks_mm_cpumask | head -5
<clear_tasks_mm_cpumask@/usr/src/debug/kernel-5.2.fc30/linux-5.2.18-200.fc30.x86_64/kernel/cpu.c:0>
0 void clear_tasks_mm_cpumask(int cpu)
1 {
2 struct task_struct *p; [root@quaco ~]# perf probe clear_tasks_mm_cpumask:0 Probe point 'clear_tasks_mm_cpumask' not found.
Error: Failed to add events.
[root@quaco
The next patch is needed to fix this case.
--- tools/perf/util/probe-finder.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)
tools/perf/util/probe-finder.c +10 -22
@@ -597,38 +597,26 @@ static int convert_to_trace_point(Dwarf_const char *function, struct probe_trace_point *tp) { - Dwarf_Addr eaddr, highaddr; + Dwarf_Addr eaddr;GElf_Sym sym;const char *symbol;/* Verify the address is correct */ -if (dwarf_entrypc (sp_die, &eaddr) !=0 ) { -pr_warning ("Failed to get entry address of %s\n" , -dwarf_diename (sp_die)); -return -ENOENT ; - } -if (dwarf_highpc (sp_die, &highaddr) !=0 ) { -pr_warning ("Failed to get end address of %s\n" , -dwarf_diename (sp_die)); -return -ENOENT ; - } -if (paddr > highaddr) { -pr_warning ("Offset specified is greater than size of %s\n" , +if (!dwarf_haspc (sp_die, paddr)) { +pr_warning ("Specified offset is out of %s\n" ,dwarf_diename (sp_die));return -EINVAL ; } - symbol =dwarf_diename (sp_die); +/* Try to get actual symbol name from symtab */ + symbol =dwfl_module_addrsym (mod, paddr, &sym,NULL );if (!symbol) { -/* Try to get the symbol name from symtab */ - symbol =dwfl_module_addrsym (mod, paddr, &sym,NULL ); -if (!symbol) { -pr_warning ("Failed to find symbol at 0x%lx\n" , - (unsigned long )paddr); -return -ENOENT ; - } - eaddr = sym.st_value; +pr_warning ("Failed to find symbol at 0x%lx\n" , + (unsigned long )paddr); +return -ENOENT ; } + eaddr = sym.st_value; + tp->offset = (unsigned long )(paddr - eaddr); tp->address = (unsigned long )paddr; tp->symbol =strdup (symbol);
Greg Kroah-Hartman
maintainerPATCH 72/76 scsi: bnx2i: fix potential use after free
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
commit 29d28f2b8d3736ac61c28ef7e20fda63795b74d9 upstream.
The member hba->pcidev may be used after its reference is dropped. Move the put function to where it is never used to avoid potential use after free issues.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hbINIT_LIST_HEAD (&hba->ep_ofld_list);INIT_LIST_HEAD (&hba->ep_active_list);INIT_LIST_HEAD (&hba->ep_destroy_list); -pci_dev_put (hba->pcidev);if (hba->regview) {pci_iounmap (hba->pcidev, hba->regview); hba->regview =NULL ; } +pci_dev_put (hba->pcidev);bnx2i_free_mp_bdt (hba);bnx2i_release_free_cid_que (hba);iscsi_host_free (shost);
Greg Kroah-Hartman
maintainerPATCH 69/76 cfg80211: check for set_wiphy_params
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 24953de0a5e31dcca7e82c8a3c79abc2dfe8fb6e upstream.
Check if set_wiphy_params is assigned and return an error if not, some drivers (e.g. virt_wifi where syzbot reported it) don't have it.
--- net/wireless/rdev-ops.h | 4 ++++ 1 file changed, 4 insertions(+)
net/wireless/rdev-ops.h +4 -0
@@ -517,6 +517,10 @@ static inline int rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed) { int ret; + +if (!rdev->ops->set_wiphy_params) +return -EOPNOTSUPP ; +trace_rdev_set_wiphy_params (&rdev->wiphy, changed); ret = rdev->ops->set_wiphy_params (&rdev->wiphy, changed);trace_rdev_return_int (&rdev->wiphy, ret);
Greg Kroah-Hartman
maintainerPATCH 63/76 macvlan: use skb_reset_mac_header() in macvlan_queue_xmit()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 1712b2fff8c682d145c7889d2290696647d82dab ]
I missed the fact that macvlan_broadcast() can be used both in RX and TX.
skb_eth_hdr() makes only sense in TX paths, so we can not use it blindly in macvlan_broadcast()
--- drivers/net/macvlan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/macvlan.c +3 -2
@@ -233,7 +233,7 @@ static void macvlan_broadcast(struct sk_ struct net_device *src, enum macvlan_mode mode) { -const struct ethhdr *eth =skb_eth_hdr (skb); +const struct ethhdr *eth =eth_hdr (skb);const struct macvlan_dev *vlan;struct sk_buff *nskb;unsigned int i;
@@ -476,10 +476,11 @@ static int macvlan_queue_xmit(struct sk_const struct macvlan_dev *dest;if (vlan->mode ==MACVLAN_MODE_BRIDGE ) { -const struct ethhdr *eth = (void *)skb->data; +const struct ethhdr *eth =skb_eth_hdr (skb);/* send to other bridge ports directly */ if (is_multicast_ether_addr (eth->h_dest)) { +skb_reset_mac_header (skb);macvlan_broadcast (skb, port, dev,MACVLAN_MODE_BRIDGE ); goto xmit_world; }
Greg Kroah-Hartman
maintainerPATCH 53/76 net: stmmac: 16KB buffer must be 16 byte aligned
In reply to Greg Kroah-HartmanFrom: Jose Abreu <[email protected]>
commit 8605131747e7e1fd8f6c9f97a00287aae2b2c640 upstream.
The 16KB RX Buffer must also be 16 byte aligned. Fix it.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +2 -2
@@ -273,8 +273,8 @@ struct dma_features {unsigned int enh_desc; }; -/* GMAC TX FIFO is 8K, Rx FIFO is 16K */ -#define BUF_SIZE_16KiB 16384 +/* RX Buffer size must be multiple of 4/8/16 bytes */ +#define BUF_SIZE_16KiB 16368#define BUF_SIZE_8KiB 8192#define BUF_SIZE_4KiB 4096#define BUF_SIZE_2KiB 2048
Greg Kroah-Hartman
maintainerPATCH 32/76 tty: serial: pch_uart: correct usage of dma_unmap_sg
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
commit 74887542fdcc92ad06a48c0cca17cdf09fc8aa00 upstream.
Per Documentation/DMA-API-HOWTO.txt,
To unmap a scatterlist, just call:
dma_unmap_sg(dev, sglist, nents, direction);
.. note::
The 'nents' argument to the dma_unmap_sg call must be the _same_ one you passed into the dma_map_sg call, it should _NOT_ be the 'count' value _returned_ from the dma_map_sg call.
However in the driver, priv->nent is directly assigned with value returned from dma_map_sg, and dma_unmap_sg use priv->nent for unmap, this breaks the API usage.
So introduce a new entry orig_nent to remember 'nents'.
--- drivers/tty/serial/pch_uart.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/pch_uart.c +4 -1
@@ -251,6 +251,7 @@ struct eg20t_port {struct dma_chan *chan_rx;struct scatterlist *sg_tx_p;int nent; +int orig_nent;struct scatterlist sg_rx;int tx_dma_use;void *rx_buf_virt;
@@ -804,9 +805,10 @@ static void pch_dma_tx_complete(void *ar } xmit->tail &=UART_XMIT_SIZE -1 ;async_tx_ack (priv->desc_tx); -dma_unmap_sg (port->dev, sg, priv->nent,DMA_TO_DEVICE ); +dma_unmap_sg (port->dev, sg, priv->orig_nent,DMA_TO_DEVICE ); priv->tx_dma_use =0 ; priv->nent =0 ; + priv->orig_nent =0 ;kfree (priv->sg_tx_p);pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_TX_INT ); }
@@ -1031,6 +1033,7 @@ static unsigned int dma_handle_tx(structdev_err (priv->port.dev,"%s:dma_map_sg Failed\n" , __func__);return 0 ; } + priv->orig_nent = num; priv->nent = nent;for (i =0 ; i < nent; i++, sg++) {
Greg Kroah-Hartman
maintainerPATCH 45/76 USB: serial: suppress driver bind attributes
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit fdb838efa31e1ed9a13ae6ad0b64e30fdbd00570 upstream.
USB-serial drivers must not be unbound from their ports before the corresponding USB driver is unbound from the parent interface so suppress the bind and unbind attributes.
Unbinding a serial driver while it's port is open is a sure way to trigger a crash as any driver state is released on unbind while port hangup is handled on the parent USB interface level. Drivers for multiport devices where ports share a resource such as an interrupt endpoint also generally cannot handle individual ports going away.
--- drivers/usb/serial/usb-serial.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/usb-serial.c +3 -0
@@ -1350,6 +1350,9 @@ static int usb_serial_register(struct usreturn -EINVAL ; } +/* Prevent individual ports from being unbound. */ + driver->driver.suppress_bind_attrs = true; +usb_serial_operations_init (driver);/* Add this device to our list of devices */
Greg Kroah-Hartman
maintainerPATCH 47/76 USB: serial: io_edgeport: add missing active-port sanity check
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 1568c58d11a7c851bd09341aeefd6a1c308ac40d upstream.
The driver receives the active port number from the device, but never made sure that the port number was valid. This could lead to a NULL-pointer dereference or memory corruption in case a device sends data for an invalid port.
--- drivers/usb/serial/io_edgeport.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/usb/serial/io_edgeport.c +7 -5
@@ -1666,7 +1666,8 @@ static void edge_break(struct tty_structstatic void process_rcvd_data (struct edgeport_serial *edge_serial,unsigned char *buffer,__u16 bufferLength) { -struct device *dev = &edge_serial->serial->dev->dev; +struct usb_serial *serial = edge_serial->serial; +struct device *dev = &serial->dev->dev;struct usb_serial_port *port;struct edgeport_port *edge_port;__u16 lastBufferLength;
@@ -1771,9 +1772,8 @@ static void process_rcvd_data(struct edg/* spit this data back into the tty driver if this port is open */ -if (rxLen) { - port = edge_serial->serial->port[ - edge_serial->rxPort]; +if (rxLen && edge_serial->rxPort < serial->num_ports) { + port = serial->port[edge_serial->rxPort]; edge_port =usb_get_serial_port_data (port);if (edge_port->open) { dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n",
@@ -1783,8 +1783,8 @@ static void process_rcvd_data(struct edg rxLen); edge_port->port->icount.rx += rxLen; } - buffer += rxLen; } + buffer += rxLen;break ;case EXPECT_HDR3 :/* Expect 3rd byte of status header */
@@ -1819,6 +1819,8 @@ static void process_rcvd_status(struct e__u8 code = edge_serial->rxStatusCode;/* switch the port pointer to the one being currently talked about */ +if (edge_serial->rxPort >= edge_serial->serial->num_ports) +return ; port = edge_serial->serial->port[edge_serial->rxPort]; edge_port =usb_get_serial_port_data (port);if (edge_port ==NULL ) {
Greg Kroah-Hartman
maintainerPATCH 46/76 USB: serial: ch341: handle unbound port at reset_resume
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 4d5ef53f75c22d28f490bcc5c771fcc610a9afa4 upstream.
Check for NULL port data in reset_resume() to avoid dereferencing a NULL pointer in case the port device isn't bound to a driver (e.g. after a failed control request at port probe).
--- drivers/usb/serial/ch341.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/serial/ch341.c +5 -1
@@ -555,9 +555,13 @@ static int ch341_tiocmget(struct tty_strstatic int ch341_reset_resume (struct usb_serial *serial) {struct usb_serial_port *port = serial->port[0 ]; -struct ch341_private *priv =usb_get_serial_port_data (port); +struct ch341_private *priv;int ret; + priv =usb_get_serial_port_data (port); +if (!priv) +return 0 ; +/* reconfigure ch341 serial port after bus-reset */ ch341_configure (serial->dev, priv);
Greg Kroah-Hartman
maintainerPATCH 8/76 p54usb: Fix race between disconnect and firmware loading
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit 6e41e2257f1094acc37618bf6c856115374c6922 upstream.
The syzbot fuzzer found a bug in the p54 USB wireless driver. The issue involves a race between disconnect and the firmware-loader callback routine, and it has several aspects.
One big problem is that when the firmware can't be loaded, the callback routine tries to unbind the driver from the USB _device_ (by calling device_release_driver) instead of from the USB _interface_ to which it is actually bound (by calling usb_driver_release_interface).
The race involves access to the private data structure. The driver's disconnect handler waits for a completion that is signalled by the firmware-loader callback routine. As soon as the completion is signalled, you have to assume that the private data structure may have been deallocated by the disconnect handler -- even if the firmware was loaded without errors. However, the callback routine does access the private data several times after that point.
Another problem is that, in order to ensure that the USB device structure hasn't been freed when the callback routine runs, the driver takes a reference to it. This isn't good enough any more, because now that the callback routine calls usb_driver_release_interface, it has to ensure that the interface structure hasn't been freed.
Finally, the driver takes an unnecessary reference to the USB device structure in the probe function and drops the reference in the disconnect handler. This extra reference doesn't accomplish anything, because the USB core already guarantees that a device structure won't be deallocated while a driver is still bound to any of its interfaces.
To fix these problems, this patch makes the following changes:
Call usb_driver_release_interface() rather than device_release_driver().
Don't signal the completion until after the important information has been copied out of the private data structure, and don't refer to the private data at all thereafter.
Lock udev (the interface's parent) before unbinding the driver instead of locking udev->parent.
During the firmware loading process, take a reference to the USB interface instead of the USB device.
Don't take an unnecessary reference to the device during probe (and then don't drop it during disconnect).
--- drivers/net/wireless/p54/p54usb.c | 43 +++++++++++++++----------------------- 1 file changed, 18 insertions(+), 25 deletions(-)
drivers/net/wireless/p54/p54usb.c +18 -25
@@ -33,6 +33,8 @@ MODULE_ALIAS("prism54usb");MODULE_FIRMWARE ("isl3886usb" );MODULE_FIRMWARE ("isl3887usb" ); +static struct usb_driver p54u_driver; +/* * Note: *
@@ -921,9 +923,9 @@ static void p54u_load_firmware_cb(const {struct p54u_priv *priv = context;struct usb_device *udev = priv->udev; +struct usb_interface *intf = priv->intf;int err; -complete (&priv->fw_wait_load);if (firmware) { priv->fw = firmware; err =p54u_start_ops (priv);
@@ -932,26 +934,22 @@ static void p54u_load_firmware_cb(constdev_err (&udev->dev,"Firmware not found.\n" ); } -if (err) { -struct device *parent = priv->udev->dev.parent; - -dev_err (&udev->dev,"failed to initialize device (%d)\n" , err); - -if (parent) -device_lock (parent); +complete (&priv->fw_wait_load); +/* +* At this point p54u_disconnect may have already freed +* the "priv" context. Do not use it anymore! +*/ + priv =NULL ; -device_release_driver (&udev->dev); -/* -* At this point p54u_disconnect has already freed -* the "priv" context. Do not use it anymore! -*/ - priv =NULL ; +if (err) { +dev_err (&intf->dev,"failed to initialize device (%d)\n" , err); -if (parent) -device_unlock (parent); +usb_lock_device (udev); +usb_driver_release_interface (&p54u_driver, intf); +usb_unlock_device (udev); } -usb_put_dev (udev); +usb_put_intf (intf); } static int p54u_load_firmware(struct ieee80211_hw *dev,
@@ -972,14 +970,14 @@ static int p54u_load_firmware(struct ieedev_info (&priv->udev->dev,"Loading firmware file %s\n" , p54u_fwlist[i].fw); -usb_get_dev (udev); +usb_get_intf (intf); err =request_firmware_nowait (THIS_MODULE ,1 , p54u_fwlist[i].fw, device,GFP_KERNEL , priv, p54u_load_firmware_cb);if (err) {dev_err (&priv->udev->dev,"(p54usb) cannot load firmware %s " "(%d)!\n" , p54u_fwlist[i].fw, err); -usb_put_dev (udev); +usb_put_intf (intf); }return err;
@@ -1011,8 +1009,6 @@ static int p54u_probe(struct usb_interfaskb_queue_head_init (&priv->rx_queue);init_usb_anchor (&priv->submitted); -usb_get_dev (udev); -/* really lazy and simple way of figuring out if we're a 3887 */ /* TODO: should just stick the identification in the device table */ i = intf->altsetting->desc.bNumEndpoints;
@@ -1053,10 +1049,8 @@ static int p54u_probe(struct usb_interfa priv->upload_fw = p54u_upload_firmware_net2280; } err =p54u_load_firmware (dev, intf); -if (err) { -usb_put_dev (udev); +if (err)p54_free_common (dev); - }return err; }
@@ -1072,7 +1066,6 @@ static void p54u_disconnect(struct usb_iwait_for_completion (&priv->fw_wait_load);p54_unregister_common (dev); -usb_put_dev (interface_to_usbdev (intf));release_firmware (priv->fw);p54_free_common (dev); }
Greg Kroah-Hartman
maintainerPATCH 28/76 mei: fix modalias documentation
In reply to Greg Kroah-HartmanFrom: Alexander Usyskin <[email protected]>
commit 73668309215285366c433489de70d31362987be9 upstream.
mei client bus added the client protocol version to the device alias, but ABI documentation was not updated.
--- Documentation/ABI/testing/sysfs-bus-mei | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/ABI/testing/sysfs-bus-mei +1 -1
@@ -4,7 +4,7 @@ KernelVersion: 3.10 Contact: Samuel Ortiz <[email protected]> [email protected] Description: Stores the same MODALIAS value emitted by uevent - Format: mei:<mei device name>:<device uuid>: + Format: mei:<mei device name>:<device uuid>:<protocol version> What: /sys/bus/mei/devices/.../name Date: May 2015
Greg Kroah-Hartman
maintainerPATCH 27/76 iio: imu: adis16480: assign bias value only if operation succeeded
In reply to Greg Kroah-HartmanFrom: Alexandru Ardelean <[email protected]>
commit 9b742763d9d4195e823ae6ece760c9ed0500c1dc upstream.
This was found only after the whole thing with the inline functions, but the compiler actually found something. The value of the bias (in adis16480_get_calibbias()) should only be set if the read operation was successful.
No actual known problem occurs as users of this function all ultimately check the return value. Hence probably not stable material.
--- drivers/iio/imu/adis16480.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/imu/adis16480.c +4 -2
@@ -372,12 +372,14 @@ static int adis16480_get_calibbias(struccase IIO_MAGN :case IIO_PRESSURE : ret =adis_read_reg_16 (&st->adis, reg, &val16); - *bias =sign_extend32 (val16,15 ); +if (ret ==0 ) + *bias =sign_extend32 (val16,15 );break ;case IIO_ANGL_VEL :case IIO_ACCEL : ret =adis_read_reg_32 (&st->adis, reg, &val32); - *bias =sign_extend32 (val32,31 ); +if (ret ==0 ) + *bias =sign_extend32 (val32,31 );break ;default : ret = -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 24/76 scsi: enclosure: Fix stale device oops with hot replug
In reply to Greg Kroah-HartmanFrom: James Bottomley <[email protected]>
commit 529244bd1afc102ab164429d338d310d5d65e60d upstream.
Doing an add/remove/add on a SCSI device in an enclosure leads to an oops caused by poisoned values in the enclosure device list pointers. The reason is because we are keeping the enclosure device across the enclosed device add/remove/add but the current code is doing a device_add/device_del/device_add on it. This is the wrong thing to do in sysfs, so fix it by not doing a device_del on the enclosure device simply because of a hot remove of the drive in the slot.
[mkp: added missing email addresses]
--- drivers/misc/enclosure.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/misc/enclosure.c +1 -2
@@ -419,10 +419,9 @@ int enclosure_remove_device(struct enclo cdev = &edev->component[i];if (cdev->dev == dev) {enclosure_remove_links (cdev); -device_del (&cdev->cdev);put_device (dev); cdev->dev =NULL ; -return device_add (&cdev->cdev); +return 0 ; } }return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 19/76 iommu: Remove device link to group on failure
In reply to Greg Kroah-HartmanFrom: Jon Derrick <[email protected]>
commit 7d4e6ccd1fb09dbfbc49746ca82bd5c25ad4bfe4 upstream.
This adds the missing teardown step that removes the device link from the group when the device addition fails.
--- drivers/iommu/iommu.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/iommu.c +1 -0
@@ -447,6 +447,7 @@ err_put_group:mutex_unlock (&group->mutex); dev->iommu_group =NULL ;kobject_put (group->devices_kobj); +sysfs_remove_link (group->devices_kobj, device->name); err_free_name:kfree (device->name); err_remove_link:
Greg Kroah-Hartman
maintainerPATCH 14/76 wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit 6f3ef5c25cc762687a7341c18cbea5af54461407 upstream.
In the implementation of i2400m_op_rfkill_sw_toggle() the allocated buffer for cmd should be released before returning. The documentation for i2400m_msg_to_dev() says when it returns the buffer can be reused. Meaning cmd should be released in either case. Move kfree(cmd) before return to be reached by all execution paths.
--- drivers/net/wimax/i2400m/op-rfkill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wimax/i2400m/op-rfkill.c +1 -1
@@ -142,12 +142,12 @@ int i2400m_op_rfkill_sw_toggle(struct wi "%d\n", result); result =0 ; error_cmd: -kfree (cmd);kfree_skb (ack_skb); error_msg_to_dev: error_alloc:d_fnend (4 , dev,"(wimax_dev %p state %d) = %d\n" , wimax_dev, state, result); +kfree (cmd);return result; }
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.211 release. There are 76 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 Fri, 24 Jan 2020 09:25:24 +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.211-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 are passing for Tegra ...
Test results for stable-v4.4:
6 builds: 6 pass, 0 fail
12 boots: 12 pass, 0 fail
19 tests: 19 pass, 0 failLinux version: 4.4.211-rc1-g14fe1f1189f5
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra30-cardhu-a04
Cheers
Jon
Signature · 1 line
nvpublic
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.211 release. There are 76 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 Fri, 24 Jan 2020 09:25:24 +0000. Anything received after that time might be too late.
Build results:
total: 170 pass: 170 fail: 0 Qemu test results: total: 326 pass: 326 fail: 0
Guenter
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.211 release. There are 76 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 Fri, 24 Jan 2020 09:25:24 +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.211-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.211-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: 14fe1f1189f56887f53ae61e2e3218be16f0c2db
git describe: v4.4.210-77-g14fe1f1189f5
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.210-77-g14fe1f1189f5
No regressions (compared to build v4.4.210)
No fixes (compared to build v4.4.210)
Ran 15214 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
* libhugetlbfs
* linux-log-parser
* ltp-commands-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-dio-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-open-posix-tests
* ltp-sched-tests
* spectre-meltdown-checker-test
* kvm-unit-tests
* ltp-cap_bounds-tests
* ltp-cpuhotplug-tests
* ltp-fcntl-locktests-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* network-basic-tests
* v4l2-compliance
* perf
* install-android-platform-tools-r2600
Summary
------------------------------------------------------------------------
kernel: 4.4.208-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git branch: 4.4.208-rc1-hikey-20200101-645
git commit: 45aaddb4efb9c8a83ada6caeb9594f7fc5130ec3
git describe: 4.4.208-rc1-hikey-20200101-645
Test details: https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.208-rc1-hikey-20200101-645
No regressions (compared to build 4.4.208-rc1-hikey-20200101-644)
No fixes (compared to build 4.4.208-rc1-hikey-20200101-644)
Ran 1568 total tests in the following environments and test suites.
Environments
--------------
- hi6220-hikey - arm64
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-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-math-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
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.211 release. There are 76 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 Fri, 24 Jan 2020 09:25:24 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.211-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