The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 2d204ee9d671327915260071c19350d84344e096 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter(a)oracle.com>
Date: Mon, 10 Sep 2018 14:12:07 +0300
Subject: [PATCH] cifs: integer overflow in in SMB2_ioctl()
The "le32_to_cpu(rsp->OutputOffset) + *plen" addition can overflow and
wrap around to a smaller value which looks like it would lead to an
information leak.
Fixes: 4a72dafa19ba ("SMB2 FSCTL and IOCTL worker function")
Signed-off-by: Dan Carpenter <dan.carpenter(a)oracle.com>
Signed-off-by: Steve French <stfrench(a)microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel(a)suse.com>
CC: Stable <stable(a)vger.kernel.org>
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 6f0e6b42599c..f54d07bda067 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2459,14 +2459,14 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
/* We check for obvious errors in the output buffer length and offset */
if (*plen == 0)
goto ioctl_exit; /* server returned no data */
- else if (*plen > 0xFF00) {
+ else if (*plen > rsp_iov.iov_len || *plen > 0xFF00) {
cifs_dbg(VFS, "srv returned invalid ioctl length: %d\n", *plen);
*plen = 0;
rc = -EIO;
goto ioctl_exit;
}
- if (rsp_iov.iov_len < le32_to_cpu(rsp->OutputOffset) + *plen) {
+ if (rsp_iov.iov_len - *plen < le32_to_cpu(rsp->OutputOffset)) {
cifs_dbg(VFS, "Malformed ioctl resp: len %d offset %d\n", *plen,
le32_to_cpu(rsp->OutputOffset));
*plen = 0;
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 00ee8b60102862f4daf0814d12a2ea2744fc0b9b Mon Sep 17 00:00:00 2001
From: Richard Weinberger <richard(a)nod.at>
Date: Mon, 11 Jun 2018 23:41:09 +0200
Subject: [PATCH] ubifs: Fix directory size calculation for symlinks
We have to account the name of the symlink and not the target length.
Fixes: ca7f85be8d6c ("ubifs: Add support for encrypted symlinks")
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Richard Weinberger <richard(a)nod.at>
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 9da224d4f2da..e8616040bffc 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1123,8 +1123,7 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
struct ubifs_inode *ui;
struct ubifs_inode *dir_ui = ubifs_inode(dir);
struct ubifs_info *c = dir->i_sb->s_fs_info;
- int err, len = strlen(symname);
- int sz_change = CALC_DENT_SIZE(len);
+ int err, sz_change, len = strlen(symname);
struct fscrypt_str disk_link;
struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
.new_ino_d = ALIGN(len, 8),
@@ -1151,6 +1150,8 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
if (err)
goto out_budg;
+ sz_change = CALC_DENT_SIZE(fname_len(&nm));
+
inode = ubifs_new_inode(c, dir, S_IFLNK | S_IRWXUGO);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
From: Coly Li <colyli(a)suse.de>
Commit b1092c9af9ed ("bcache: allow quick writeback when backing idle")
allows the writeback rate to be faster if there is no I/O request on a
bcache device. It works well if there is only one bcache device attached
to the cache set. If there are many bcache devices attached to a cache
set, it may introduce performance regression because multiple faster
writeback threads of the idle bcache devices will compete the btree level
locks with the bcache device who have I/O requests coming.
This patch fixes the above issue by only permitting fast writebac when
all bcache devices attached on the cache set are idle. And if one of the
bcache devices has new I/O request coming, minimized all writeback
throughput immediately and let PI controller __update_writeback_rate()
to decide the upcoming writeback rate for each bcache device.
Also when all bcache devices are idle, limited wrieback rate to a small
number is wast of thoughput, especially when backing devices are slower
non-rotation devices (e.g. SATA SSD). This patch sets a max writeback
rate for each backing device if the whole cache set is idle. A faster
writeback rate in idle time means new I/Os may have more available space
for dirty data, and people may observe a better write performance then.
Please note bcache may change its cache mode in run time, and this patch
still works if the cache mode is switched from writeback mode and there
is still dirty data on cache.
Fixes: Commit b1092c9af9ed ("bcache: allow quick writeback when backing idle")
Cc: stable(a)vger.kernel.org #4.16+
Signed-off-by: Coly Li <colyli(a)suse.de>
Tested-by: Kai Krakow <kai(a)kaishome.de>
Tested-by: Stefan Priebe <s.priebe(a)profihost.ag>
Cc: Michael Lyle <mlyle(a)lyle.org>
Signed-off-by: Jens Axboe <axboe(a)kernel.dk>
(cherry picked from commit ea8c5356d39048bc94bae068228f51ddbecc6b89)
Signed-off-by: Kai Krakow <kai(a)kaishome.de>
---
drivers/md/bcache/bcache.h | 10 ++---
drivers/md/bcache/request.c | 54 ++++++++++++++++++++++++-
drivers/md/bcache/super.c | 4 ++
drivers/md/bcache/sysfs.c | 14 +++++--
drivers/md/bcache/util.c | 2 +-
drivers/md/bcache/util.h | 2 +-
drivers/md/bcache/writeback.c | 91 +++++++++++++++++++++++++++++--------------
7 files changed, 133 insertions(+), 44 deletions(-)
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index d6bf294f3907..6ba41887664a 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -328,13 +328,6 @@ struct cached_dev {
*/
atomic_t has_dirty;
- /*
- * Set to zero by things that touch the backing volume-- except
- * writeback. Incremented by writeback. Used to determine when to
- * accelerate idle writeback.
- */
- atomic_t backing_idle;
-
struct bch_ratelimit writeback_rate;
struct delayed_work writeback_rate_update;
@@ -514,6 +507,8 @@ struct cache_set {
struct cache_accounting accounting;
unsigned long flags;
+ atomic_t idle_counter;
+ atomic_t at_max_writeback_rate;
struct cache_sb sb;
@@ -523,6 +518,7 @@ struct cache_set {
struct bcache_device **devices;
unsigned devices_max_used;
+ atomic_t attached_dev_nr;
struct list_head cached_devs;
uint64_t cached_dev_sectors;
struct closure caching;
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index ae67f5fa8047..6e08eb89abee 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1102,6 +1102,44 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio)
generic_make_request(bio);
}
+static void quit_max_writeback_rate(struct cache_set *c,
+ struct cached_dev *this_dc)
+{
+ int i;
+ struct bcache_device *d;
+ struct cached_dev *dc;
+
+ /*
+ * mutex bch_register_lock may compete with other parallel requesters,
+ * or attach/detach operations on other backing device. Waiting to
+ * the mutex lock may increase I/O request latency for seconds or more.
+ * To avoid such situation, if mutext_trylock() failed, only writeback
+ * rate of current cached device is set to 1, and __update_write_back()
+ * will decide writeback rate of other cached devices (remember now
+ * c->idle_counter is 0 already).
+ */
+ if (mutex_trylock(&bch_register_lock)) {
+ for (i = 0; i < c->devices_max_used; i++) {
+ if (!c->devices[i])
+ continue;
+
+ if (UUID_FLASH_ONLY(&c->uuids[i]))
+ continue;
+
+ d = c->devices[i];
+ dc = container_of(d, struct cached_dev, disk);
+ /*
+ * set writeback rate to default minimum value,
+ * then let update_writeback_rate() to decide the
+ * upcoming rate.
+ */
+ atomic_long_set(&dc->writeback_rate.rate, 1);
+ }
+ mutex_unlock(&bch_register_lock);
+ } else
+ atomic_long_set(&this_dc->writeback_rate.rate, 1);
+}
+
/* Cached devices - read & write stuff */
static blk_qc_t cached_dev_make_request(struct request_queue *q,
@@ -1119,7 +1157,21 @@ static blk_qc_t cached_dev_make_request(struct request_queue *q,
return BLK_QC_T_NONE;
}
- atomic_set(&dc->backing_idle, 0);
+ if (likely(d->c)) {
+ if (atomic_read(&d->c->idle_counter))
+ atomic_set(&d->c->idle_counter, 0);
+ /*
+ * If at_max_writeback_rate of cache set is true and new I/O
+ * comes, quit max writeback rate of all cached devices
+ * attached to this cache set, and set at_max_writeback_rate
+ * to false.
+ */
+ if (unlikely(atomic_read(&d->c->at_max_writeback_rate) == 1)) {
+ atomic_set(&d->c->at_max_writeback_rate, 0);
+ quit_max_writeback_rate(d->c, dc);
+ }
+ }
+
generic_start_io_acct(q, rw, bio_sectors(bio), &d->disk->part0);
bio_set_dev(bio, dc->bdev);
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index fa4058e43202..dc7b6131ddbb 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -696,6 +696,8 @@ static void bcache_device_detach(struct bcache_device *d)
{
lockdep_assert_held(&bch_register_lock);
+ atomic_dec(&d->c->attached_dev_nr);
+
if (test_bit(BCACHE_DEV_DETACHING, &d->flags)) {
struct uuid_entry *u = d->c->uuids + d->id;
@@ -1138,6 +1140,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
bch_cached_dev_run(dc);
bcache_device_link(&dc->disk, c, "bdev");
+ atomic_inc(&c->attached_dev_nr);
/* Allow the writeback thread to proceed */
up_write(&dc->writeback_lock);
@@ -1687,6 +1690,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)
c->block_bits = ilog2(sb->block_size);
c->nr_uuids = bucket_bytes(c) / sizeof(struct uuid_entry);
c->devices_max_used = 0;
+ atomic_set(&c->attached_dev_nr, 0);
c->btree_pages = bucket_pages(c);
if (c->btree_pages > BTREE_MAX_PAGES)
c->btree_pages = max_t(int, c->btree_pages / 4,
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
index 225b15aa0340..a56067e80b10 100644
--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -170,7 +170,8 @@ SHOW(__bch_cached_dev)
var_printf(writeback_running, "%i");
var_print(writeback_delay);
var_print(writeback_percent);
- sysfs_hprint(writeback_rate, dc->writeback_rate.rate << 9);
+ sysfs_hprint(writeback_rate,
+ atomic_long_read(&dc->writeback_rate.rate) << 9);
sysfs_hprint(io_errors, atomic_read(&dc->io_errors));
sysfs_printf(io_error_limit, "%i", dc->error_limit);
sysfs_printf(io_disable, "%i", dc->io_disable);
@@ -188,7 +189,8 @@ SHOW(__bch_cached_dev)
char change[20];
s64 next_io;
- bch_hprint(rate, dc->writeback_rate.rate << 9);
+ bch_hprint(rate,
+ atomic_long_read(&dc->writeback_rate.rate) << 9);
bch_hprint(dirty, bcache_dev_sectors_dirty(&dc->disk) << 9);
bch_hprint(target, dc->writeback_rate_target << 9);
bch_hprint(proportional,dc->writeback_rate_proportional << 9);
@@ -255,8 +257,12 @@ STORE(__cached_dev)
sysfs_strtoul_clamp(writeback_percent, dc->writeback_percent, 0, 40);
- sysfs_strtoul_clamp(writeback_rate,
- dc->writeback_rate.rate, 1, INT_MAX);
+ if (attr == &sysfs_writeback_rate) {
+ int v;
+
+ sysfs_strtoul_clamp(writeback_rate, v, 1, INT_MAX);
+ atomic_long_set(&dc->writeback_rate.rate, v);
+ }
sysfs_strtoul_clamp(writeback_rate_update_seconds,
dc->writeback_rate_update_seconds,
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c
index fc479b026d6d..b15256bcf0e7 100644
--- a/drivers/md/bcache/util.c
+++ b/drivers/md/bcache/util.c
@@ -200,7 +200,7 @@ uint64_t bch_next_delay(struct bch_ratelimit *d, uint64_t done)
{
uint64_t now = local_clock();
- d->next += div_u64(done * NSEC_PER_SEC, d->rate);
+ d->next += div_u64(done * NSEC_PER_SEC, atomic_long_read(&d->rate));
/* Bound the time. Don't let us fall further than 2 seconds behind
* (this prevents unnecessary backlog that would make it impossible
diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h
index cced87f8eb27..f7b0133c9d2f 100644
--- a/drivers/md/bcache/util.h
+++ b/drivers/md/bcache/util.h
@@ -442,7 +442,7 @@ struct bch_ratelimit {
* Rate at which we want to do work, in units per second
* The units here correspond to the units passed to bch_next_delay()
*/
- uint32_t rate;
+ atomic_long_t rate;
};
static inline void bch_ratelimit_reset(struct bch_ratelimit *d)
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index ad45ebe1a74b..9f5e33324d1d 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -104,11 +104,56 @@ static void __update_writeback_rate(struct cached_dev *dc)
dc->writeback_rate_proportional = proportional_scaled;
dc->writeback_rate_integral_scaled = integral_scaled;
- dc->writeback_rate_change = new_rate - dc->writeback_rate.rate;
- dc->writeback_rate.rate = new_rate;
+ dc->writeback_rate_change = new_rate -
+ atomic_long_read(&dc->writeback_rate.rate);
+ atomic_long_set(&dc->writeback_rate.rate, new_rate);
dc->writeback_rate_target = target;
}
+static bool set_at_max_writeback_rate(struct cache_set *c,
+ struct cached_dev *dc)
+{
+ /*
+ * Idle_counter is increased everytime when update_writeback_rate() is
+ * called. If all backing devices attached to the same cache set have
+ * identical dc->writeback_rate_update_seconds values, it is about 6
+ * rounds of update_writeback_rate() on each backing device before
+ * c->at_max_writeback_rate is set to 1, and then max wrteback rate set
+ * to each dc->writeback_rate.rate.
+ * In order to avoid extra locking cost for counting exact dirty cached
+ * devices number, c->attached_dev_nr is used to calculate the idle
+ * throushold. It might be bigger if not all cached device are in write-
+ * back mode, but it still works well with limited extra rounds of
+ * update_writeback_rate().
+ */
+ if (atomic_inc_return(&c->idle_counter) <
+ atomic_read(&c->attached_dev_nr) * 6)
+ return false;
+
+ if (atomic_read(&c->at_max_writeback_rate) != 1)
+ atomic_set(&c->at_max_writeback_rate, 1);
+
+ atomic_long_set(&dc->writeback_rate.rate, INT_MAX);
+
+ /* keep writeback_rate_target as existing value */
+ dc->writeback_rate_proportional = 0;
+ dc->writeback_rate_integral_scaled = 0;
+ dc->writeback_rate_change = 0;
+
+ /*
+ * Check c->idle_counter and c->at_max_writeback_rate agagain in case
+ * new I/O arrives during before set_at_max_writeback_rate() returns.
+ * Then the writeback rate is set to 1, and its new value should be
+ * decided via __update_writeback_rate().
+ */
+ if ((atomic_read(&c->idle_counter) <
+ atomic_read(&c->attached_dev_nr) * 6) ||
+ !atomic_read(&c->at_max_writeback_rate))
+ return false;
+
+ return true;
+}
+
static void update_writeback_rate(struct work_struct *work)
{
struct cached_dev *dc = container_of(to_delayed_work(work),
@@ -136,13 +181,20 @@ static void update_writeback_rate(struct work_struct *work)
return;
}
- down_read(&dc->writeback_lock);
+ if (atomic_read(&dc->has_dirty) && dc->writeback_percent) {
+ /*
+ * If the whole cache set is idle, set_at_max_writeback_rate()
+ * will set writeback rate to a max number. Then it is
+ * unncessary to update writeback rate for an idle cache set
+ * in maximum writeback rate number(s).
+ */
+ if (!set_at_max_writeback_rate(c, dc)) {
+ down_read(&dc->writeback_lock);
+ __update_writeback_rate(dc);
+ up_read(&dc->writeback_lock);
+ }
+ }
- if (atomic_read(&dc->has_dirty) &&
- dc->writeback_percent)
- __update_writeback_rate(dc);
-
- up_read(&dc->writeback_lock);
/*
* CACHE_SET_IO_DISABLE might be set via sysfs interface,
@@ -422,27 +474,6 @@ static void read_dirty(struct cached_dev *dc)
delay = writeback_delay(dc, size);
- /* If the control system would wait for at least half a
- * second, and there's been no reqs hitting the backing disk
- * for awhile: use an alternate mode where we have at most
- * one contiguous set of writebacks in flight at a time. If
- * someone wants to do IO it will be quick, as it will only
- * have to contend with one operation in flight, and we'll
- * be round-tripping data to the backing disk as quickly as
- * it can accept it.
- */
- if (delay >= HZ / 2) {
- /* 3 means at least 1.5 seconds, up to 7.5 if we
- * have slowed way down.
- */
- if (atomic_inc_return(&dc->backing_idle) >= 3) {
- /* Wait for current I/Os to finish */
- closure_sync(&cl);
- /* And immediately launch a new set. */
- delay = 0;
- }
- }
-
while (!kthread_should_stop() &&
!test_bit(CACHE_SET_IO_DISABLE, &dc->disk.c->flags) &&
delay) {
@@ -715,7 +746,7 @@ void bch_cached_dev_writeback_init(struct cached_dev *dc)
dc->writeback_running = true;
dc->writeback_percent = 10;
dc->writeback_delay = 30;
- dc->writeback_rate.rate = 1024;
+ atomic_long_set(&dc->writeback_rate.rate, 1024);
dc->writeback_rate_minimum = 8;
dc->writeback_rate_update_seconds = WRITEBACK_RATE_UPDATE_SECS_DEFAULT;
--
2.16.4
Hi,
[This is an automated email]
This commit has been processed by the -stable helper bot and determined
to be a high probability candidate for -stable trees. (score: 46.9374)
The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.
v4.16.1: Build OK!
v4.15.16: Build OK!
v4.14.33: Build OK!
v4.9.93: Failed to apply! Possible dependencies:
9648dc15772d ("recordmcount: arm: Implement make_nop")
v4.4.127: Failed to apply! Possible dependencies:
9648dc15772d ("recordmcount: arm: Implement make_nop")
Please let us know if you'd like to have this patch included in a stable tree.
--
Thanks,
Sasha
This is the start of the stable review cycle for the 4.14.71 release.
There are 126 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 Wed Sep 19 21:16:12 UTC 2018.
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.14.71-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.14.71-rc1
Linus Torvalds <torvalds(a)linux-foundation.org>
mm: get rid of vmacache_flush_all() entirely
Ian Kent <raven(a)themaw.net>
autofs: fix autofs_sbi() does not check super block type
Jason Wang <jasowang(a)redhat.com>
tuntap: fix use after free during release
Jason Wang <jasowang(a)redhat.com>
tun: fix use after free for ptr_ring
Wei Yongjun <weiyongjun1(a)huawei.com>
mtd: ubi: wl: Fix error return code in ubi_wl_init()
Taehee Yoo <ap420073(a)gmail.com>
ip: frags: fix crash in ip_do_fragment()
Peter Oskolkov <posk(a)google.com>
ip: process in-order fragments efficiently
Peter Oskolkov <posk(a)google.com>
ip: add helpers to process in-order fragments faster.
Dan Carpenter <dan.carpenter(a)oracle.com>
ipv4: frags: precedence bug in ip_expire()
Eric Dumazet <edumazet(a)google.com>
net: sk_buff rbnode reorg
Eric Dumazet <edumazet(a)google.com>
net: add rb_to_skb() and other rb tree helpers
Eric Dumazet <edumazet(a)google.com>
net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends
Florian Westphal <fw(a)strlen.de>
ipv6: defrag: drop non-last frags smaller than min mtu
Peter Oskolkov <posk(a)google.com>
net: modify skb_rbtree_purge to return the truesize of all purged skbs.
Eric Dumazet <edumazet(a)google.com>
net: speed up skb_rbtree_purge()
Peter Oskolkov <posk(a)google.com>
ip: discard IPv4 datagrams with overlapping segments.
Eric Dumazet <edumazet(a)google.com>
inet: frags: fix ip6frag_low_thresh boundary
Eric Dumazet <edumazet(a)google.com>
inet: frags: get rid of ipfrag_skb_cb/FRAG_CB
Eric Dumazet <edumazet(a)google.com>
inet: frags: reorganize struct netns_frags
Eric Dumazet <edumazet(a)google.com>
rhashtable: reorganize struct rhashtable layout
Eric Dumazet <edumazet(a)google.com>
ipv6: frags: rewrite ip6_expire_frag_queue()
Eric Dumazet <edumazet(a)google.com>
inet: frags: do not clone skb in ip_expire()
Eric Dumazet <edumazet(a)google.com>
inet: frags: break the 2GB limit for frags storage
Eric Dumazet <edumazet(a)google.com>
inet: frags: remove inet_frag_maybe_warn_overflow()
Eric Dumazet <edumazet(a)google.com>
inet: frags: get rif of inet_frag_evicting()
Eric Dumazet <edumazet(a)google.com>
inet: frags: remove some helpers
Eric Dumazet <edumazet(a)google.com>
inet: frags: use rhashtables for reassembly units
Eric Dumazet <edumazet(a)google.com>
rhashtable: add schedule points
Eric Dumazet <edumazet(a)google.com>
ipv6: export ip6 fragments sysctl to unprivileged users
Eric Dumazet <edumazet(a)google.com>
inet: frags: refactor lowpan_net_frag_init()
Eric Dumazet <edumazet(a)google.com>
inet: frags: refactor ipv6_frag_init()
Kees Cook <keescook(a)chromium.org>
inet: frags: Convert timers to use timer_setup()
Eric Dumazet <edumazet(a)google.com>
inet: frags: refactor ipfrag_init()
Eric Dumazet <edumazet(a)google.com>
inet: frags: add a pointer to struct netns_frags
Eric Dumazet <edumazet(a)google.com>
inet: frags: change inet_frags_init_net() return value
Jani Nikula <jani.nikula(a)intel.com>
drm/i915: set DP Main Stream Attribute for color range on DDI platforms
Parav Pandit <parav(a)mellanox.com>
RDMA/cma: Do not ignore net namespace for unbound cm_id
Paul Burton <paul.burton(a)mips.com>
MIPS: WARN_ON invalid DMA cache maintenance, not BUG_ON
Trond Myklebust <trond.myklebust(a)hammerspace.com>
NFSv4.1: Fix a potential layoutget/layoutrecall deadlock
Chao Yu <yuchao0(a)huawei.com>
f2fs: fix to do sanity check with {sit,nat}_ver_bitmap_bytesize
Zumeng Chen <zumeng.chen(a)gmail.com>
mfd: ti_am335x_tscadc: Fix struct clk memory leak
Geert Uytterhoeven <geert+renesas(a)glider.be>
iommu/ipmmu-vmsa: Fix allocation in atomic context
Dan Carpenter <dan.carpenter(a)oracle.com>
f2fs: Fix uninitialized return in f2fs_ioc_shutdown()
Chao Yu <yuchao0(a)huawei.com>
f2fs: fix to wait on page writeback before updating page
Katsuhiro Suzuki <suzuki.katsuhiro(a)socionext.com>
media: helene: fix xtal frequency setting at power on
Mauricio Faria de Oliveira <mfo(a)canonical.com>
partitions/aix: fix usage of uninitialized lv_info and lvname structures
Mauricio Faria de Oliveira <mfo(a)canonical.com>
partitions/aix: append null character to print data from disk
Sylwester Nawrocki <s.nawrocki(a)samsung.com>
media: s5p-mfc: Fix buffer look up in s5p_mfc_handle_frame_{new, copy_time} functions
Nick Dyer <nick.dyer(a)itdev.co.uk>
Input: atmel_mxt_ts - only use first T9 instance
John Pittman <jpittman(a)redhat.com>
dm cache: only allow a single io_mode cache feature to be requested
Petr Machata <petrm(a)mellanox.com>
net: dcb: For wild-card lookups, use priority -1, not 0
Nicholas Mc Guire <hofrat(a)osadl.org>
MIPS: generic: fix missing of_node_put()
Nicholas Mc Guire <hofrat(a)osadl.org>
MIPS: Octeon: add missing of_node_put()
Chao Yu <yuchao0(a)huawei.com>
f2fs: fix to do sanity check with reserved blkaddr of inline inode
Peter Rosin <peda(a)axentia.se>
tpm/tpm_i2c_infineon: switch to i2c_lock_bus(..., I2C_LOCK_SEGMENT)
Linus Walleij <linus.walleij(a)linaro.org>
tpm_tis_spi: Pass the SPI IRQ down to the driver
Chao Yu <yuchao0(a)huawei.com>
f2fs: fix to skip GC if type in SSA and SIT is inconsistent
Jinbum Park <jinb.park7(a)gmail.com>
pktcdvd: Fix possible Spectre-v1 for pkt_devs
Chao Yu <yuchao0(a)huawei.com>
f2fs: try grabbing node page lock aggressively in sync scenario
Yelena Krivosheev <yelena(a)marvell.com>
net: mvneta: fix mtu change on port without link
Daniel Kurtz <djkurtz(a)chromium.org>
pinctrl/amd: only handle irq if it is pending and unmasked
Anton Vasilyev <vasilyev(a)ispras.ru>
gpio: ml-ioh: Fix buffer underwrite on probe error path
Dan Carpenter <dan.carpenter(a)oracle.com>
pinctrl: imx: off by one in imx_pinconf_group_dbg_show()
Joerg Roedel <jroedel(a)suse.de>
x86/mm: Remove in_nmi() warning from vmalloc_fault()
Marcel Holtmann <marcel(a)holtmann.org>
Bluetooth: hidp: Fix handling of strncpy for hid->name information
Surabhi Vishnoi <svishnoi(a)codeaurora.org>
ath10k: disable bundle mgmt tx completion event support
Huaisheng Ye <yehs1(a)lenovo.com>
tools/testing/nvdimm: kaddr and pfn can be NULL to ->direct_access()
Anton Vasilyev <vasilyev(a)ispras.ru>
scsi: 3ware: fix return 0 on the error path of probe
Srinivas Pandruvada <srinivas.pandruvada(a)linux.intel.com>
ata: libahci: Correct setting of DEVSLP register
Srinivas Pandruvada <srinivas.pandruvada(a)linux.intel.com>
ata: libahci: Allow reconfigure of DEVSLP register
Paul Burton <paul.burton(a)mips.com>
MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET
Srinivas Kandagatla <srinivas.kandagatla(a)linaro.org>
rpmsg: core: add support to power domains for devices
Loic Poulain <loic.poulain(a)linaro.org>
wlcore: Set rx_status boottime_ns field on rx
Sven Eckelmann <sven.eckelmann(a)openmesh.com>
ath10k: prevent active scans on potential unusable channels
Felix Fietkau <nbd(a)nbd.name>
ath9k_hw: fix channel maximum power level test
Felix Fietkau <nbd(a)nbd.name>
ath9k: report tx status on EOSP
Finn Thain <fthain(a)telegraphics.com.au>
macintosh/via-pmu: Add missing mmio accessors
Kan Liang <kan.liang(a)linux.intel.com>
perf evlist: Fix error out while applying initial delay and LBR
Jiri Olsa <jolsa(a)kernel.org>
perf c2c report: Fix crash for empty browser
Olga Kornievskaia <kolga(a)netapp.com>
NFSv4.0 fix client reference leak in callback
Christophe Leroy <christophe.leroy(a)c-s.fr>
perf tools: Allow overriding MAX_NR_CPUS at compile time
Randy Dunlap <rdunlap(a)infradead.org>
f2fs: fix defined but not used build warnings
Yunlong Song <yunlong.song(a)huawei.com>
f2fs: do not set free of current section
Chao Yu <yuchao0(a)huawei.com>
f2fs: fix to active page in lru list for read path
Anton Vasilyev <vasilyev(a)ispras.ru>
tty: rocket: Fix possible buffer overwrite on register_PCI
Michael Kelley <mikelley(a)microsoft.com>
Drivers: hv: vmbus: Cleanup synic memory free path
Anton Vasilyev <vasilyev(a)ispras.ru>
firmware: vpd: Fix section enabled flag on vpd_section_destroy
Dan Carpenter <dan.carpenter(a)oracle.com>
uio: potential double frees if __uio_register_device() fails
Anton Vasilyev <vasilyev(a)ispras.ru>
misc: ti-st: Fix memory leak in the error path of probe()
Philipp Zabel <p.zabel(a)pengutronix.de>
gpu: ipu-v3: default to id 0 on missing OF alias
Todor Tomov <todor.tomov(a)linaro.org>
media: camss: csid: Configure data type and decode format properly
Gaurav Kohli <gkohli(a)codeaurora.org>
timers: Clear timer_base::must_forward_clk with timer_base::lock held
BingJing Chang <bingjingc(a)synology.com>
md/raid5: fix data corruption of replacements after originals dropped
Mike Christie <mchristi(a)redhat.com>
scsi: target: fix __transport_register_session locking
Ming Lei <ming.lei(a)redhat.com>
blk-mq: fix updating tags depth
Arun Parameswaran <arun.parameswaran(a)broadcom.com>
net: phy: Fix the register offsets in Broadcom iProc mdio mux driver
Anton Vasilyev <vasilyev(a)ispras.ru>
media: dw2102: Fix memleak on sequence of probes
Anton Vasilyev <vasilyev(a)ispras.ru>
media: davinci: vpif_display: Mix memory leak on probe error path
Roman Gushchin <guro(a)fb.com>
selftests/bpf: fix a typo in map in map test
Reza Arbab <arbab(a)linux.ibm.com>
powerpc/powernv: Fix concurrency issue with npu->mmio_atsd_usage
Dmitry Osipenko <digetx(a)gmail.com>
gpio: tegra: Move driver registration to subsys_init level
Johan Hedberg <johan.hedberg(a)intel.com>
Bluetooth: h5: Fix missing dependency on BT_HCIUART_SERDEV
Jae Hyun Yoo <jae.hyun.yoo(a)linux.intel.com>
i2c: aspeed: Add an explicit type casting for *get_clk_reg_val
Florian Fainelli <f.fainelli(a)gmail.com>
ethtool: Remove trailing semicolon for static inline
Dan Carpenter <dan.carpenter(a)oracle.com>
misc: mic: SCIF Fix scif_get_new_port() error handling
Alexey Brodkin <abrodkin(a)synopsys.com>
ARC: [plat-axs*]: Enable SWAP
Tomas Winkler <tomas.winkler(a)intel.com>
tpm: separate cmd_ready/go_idle from runtime_pm
Arnd Bergmann <arnd(a)arndb.de>
crypto: aes-generic - fix aes-generic regression on powerpc
Gustavo A. R. Silva <gustavo(a)embeddedor.com>
switchtec: Fix Spectre v1 vulnerability
Filippo Sironi <sironi(a)amazon.de>
x86/microcode: Update the new microcode revision unconditionally
Prarit Bhargava <prarit(a)redhat.com>
x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
Thomas Gleixner <tglx(a)linutronix.de>
cpu/hotplug: Prevent state corruption on error rollback
Neeraj Upadhyay <neeraju(a)codeaurora.org>
cpu/hotplug: Adjust misplaced smb() in cpuhp_thread_fun()
Takashi Iwai <tiwai(a)suse.de>
ALSA: hda - Fix cancel_work_sync() stall from jackpoll work
Sean Christopherson <sean.j.christopherson(a)intel.com>
KVM: VMX: Do not allow reexecute_instruction() when skipping MMIO instr
Pierre Morel <pmorel(a)linux.ibm.com>
KVM: s390: vsie: copy wrapping keys to right place
Filipe Manana <fdmanana(a)suse.com>
Btrfs: fix data corruption when deduplicating between different files
Steve French <stfrench(a)microsoft.com>
smb3: check for and properly advertise directory lease support
Steve French <stfrench(a)microsoft.com>
SMB3: Backup intent flag missing for directory opens with backupuid mounts
Paul Burton <paul.burton(a)mips.com>
MIPS: VDSO: Match data page cache colouring when D$ aliases
Minchan Kim <minchan(a)kernel.org>
android: binder: fix the race mmap and alloc_new_buf_locked
Konstantin Khlebnikov <khlebnikov(a)yandex-team.ru>
block: bfq: swap puts in bfqg_and_blkg_put
Jens Axboe <axboe(a)kernel.dk>
nbd: don't allow invalid blocksize settings
James Smart <jsmart2021(a)gmail.com>
scsi: lpfc: Correct MDS diag and nvmet configuration
Felipe Balbi <felipe.balbi(a)linux.intel.com>
i2c: i801: fix DNV's SMBCTRL register offset
Shubhrajyoti Datta <shubhrajyoti.datta(a)xilinx.com>
i2c: xiic: Make the start and the byte count write atomic
-------------
Diffstat:
Documentation/networking/ip-sysctl.txt | 13 +-
Makefile | 4 +-
arch/arc/configs/axs101_defconfig | 1 -
arch/arc/configs/axs103_defconfig | 1 -
arch/arc/configs/axs103_smp_defconfig | 1 -
arch/mips/cavium-octeon/octeon-platform.c | 2 +
arch/mips/generic/init.c | 1 +
arch/mips/include/asm/io.h | 8 +-
arch/mips/kernel/vdso.c | 20 +
arch/mips/mm/c-r4k.c | 6 +-
arch/powerpc/platforms/powernv/npu-dma.c | 5 +-
arch/s390/kvm/vsie.c | 3 +-
arch/x86/kernel/cpu/microcode/amd.c | 24 +-
arch/x86/kernel/cpu/microcode/intel.c | 17 +-
arch/x86/kvm/vmx.c | 4 +-
arch/x86/mm/fault.c | 2 -
block/bfq-cgroup.c | 4 +-
block/blk-mq-tag.c | 8 +-
block/partitions/aix.c | 13 +-
crypto/Makefile | 2 +-
drivers/android/binder_alloc.c | 42 +-
drivers/ata/libahci.c | 20 +-
drivers/block/nbd.c | 3 +
drivers/block/pktcdvd.c | 4 +-
drivers/bluetooth/Kconfig | 1 +
drivers/char/tpm/tpm-interface.c | 50 +-
drivers/char/tpm/tpm.h | 12 +-
drivers/char/tpm/tpm2-space.c | 16 +-
drivers/char/tpm/tpm_crb.c | 101 +---
drivers/char/tpm/tpm_i2c_infineon.c | 8 +-
drivers/char/tpm/tpm_tis_spi.c | 9 +-
drivers/firmware/google/vpd.c | 5 +-
drivers/gpio/gpio-ml-ioh.c | 3 +-
drivers/gpio/gpio-tegra.c | 2 +-
drivers/gpu/drm/i915/i915_reg.h | 1 +
drivers/gpu/drm/i915/intel_ddi.c | 4 +
drivers/gpu/ipu-v3/ipu-common.c | 2 +
drivers/hv/hv.c | 14 +-
drivers/i2c/busses/i2c-aspeed.c | 2 +-
drivers/i2c/busses/i2c-i801.c | 7 +-
drivers/i2c/busses/i2c-xiic.c | 4 +
drivers/infiniband/core/cma.c | 13 +-
drivers/input/touchscreen/atmel_mxt_ts.c | 7 +-
drivers/iommu/ipmmu-vmsa.c | 9 +-
drivers/macintosh/via-pmu.c | 9 +-
drivers/md/dm-cache-target.c | 19 +-
drivers/md/raid5.c | 6 +
drivers/media/dvb-frontends/helene.c | 5 +-
drivers/media/platform/davinci/vpif_display.c | 24 +-
.../media/platform/qcom/camss-8x16/camss-csid.c | 16 +-
drivers/media/platform/s5p-mfc/s5p_mfc.c | 23 +-
drivers/media/usb/dvb-usb/dw2102.c | 19 +-
drivers/mfd/ti_am335x_tscadc.c | 3 +-
drivers/misc/mic/scif/scif_api.c | 20 +-
drivers/misc/ti-st/st_kim.c | 4 +-
drivers/mtd/ubi/wl.c | 8 +-
drivers/net/ethernet/marvell/mvneta.c | 1 -
drivers/net/phy/mdio-mux-bcm-iproc.c | 20 +-
drivers/net/tun.c | 21 +-
drivers/net/wireless/ath/ath10k/mac.c | 7 +
drivers/net/wireless/ath/ath10k/wmi-tlv.c | 5 +
drivers/net/wireless/ath/ath10k/wmi-tlv.h | 5 +
drivers/net/wireless/ath/ath9k/hw.c | 7 +-
drivers/net/wireless/ath/ath9k/xmit.c | 3 +-
drivers/net/wireless/ti/wlcore/rx.c | 8 +-
drivers/pci/switch/switchtec.c | 4 +
drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
drivers/pinctrl/pinctrl-amd.c | 3 +-
drivers/rpmsg/rpmsg_core.c | 7 +
drivers/scsi/3w-9xxx.c | 6 +-
drivers/scsi/3w-sas.c | 3 +
drivers/scsi/3w-xxxx.c | 2 +
drivers/scsi/lpfc/lpfc.h | 2 +-
drivers/target/target_core_transport.c | 5 +-
drivers/tty/rocket.c | 2 +-
drivers/uio/uio.c | 3 +-
fs/autofs4/autofs_i.h | 4 +-
fs/autofs4/inode.c | 1 -
fs/btrfs/ioctl.c | 19 +
fs/cifs/inode.c | 2 +
fs/cifs/smb2ops.c | 35 +-
fs/cifs/smb2pdu.c | 3 +
fs/f2fs/f2fs.h | 7 +-
fs/f2fs/file.c | 2 +-
fs/f2fs/gc.c | 8 +-
fs/f2fs/inline.c | 22 +
fs/f2fs/node.c | 4 +-
fs/f2fs/segment.h | 3 +
fs/f2fs/super.c | 21 +-
fs/f2fs/sysfs.c | 10 +-
fs/nfs/callback_proc.c | 4 +-
fs/nfs/callback_xdr.c | 11 +-
include/linux/mm_types.h | 2 +-
include/linux/mm_types_task.h | 2 +-
include/linux/rhashtable.h | 8 +-
include/linux/skbuff.h | 50 +-
include/linux/tpm.h | 2 +
include/linux/vm_event_item.h | 1 -
include/linux/vmacache.h | 5 -
include/net/inet_frag.h | 135 +++--
include/net/ip.h | 1 -
include/net/ipv6.h | 26 +-
include/uapi/linux/ethtool.h | 4 +-
include/uapi/linux/snmp.h | 1 +
kernel/cpu.c | 11 +-
kernel/time/timer.c | 29 +-
lib/rhashtable.c | 2 +
mm/debug.c | 4 +-
mm/vmacache.c | 38 --
net/bluetooth/hidp/core.c | 2 +-
net/core/skbuff.c | 31 +-
net/dcb/dcbnl.c | 11 +-
net/ieee802154/6lowpan/6lowpan_i.h | 26 +-
net/ieee802154/6lowpan/reassembly.c | 153 +++---
net/ipv4/inet_fragment.c | 378 +++-----------
net/ipv4/ip_fragment.c | 578 ++++++++++++---------
net/ipv4/proc.c | 7 +-
net/ipv4/tcp_fastopen.c | 8 +-
net/ipv4/tcp_input.c | 33 +-
net/ipv6/netfilter/nf_conntrack_reasm.c | 105 ++--
net/ipv6/proc.c | 5 +-
net/ipv6/reassembly.c | 217 ++++----
net/sched/sch_netem.c | 14 +-
sound/pci/hda/hda_codec.c | 3 +-
tools/perf/builtin-c2c.c | 3 +
tools/perf/perf.h | 2 +
tools/perf/util/evsel.c | 14 +
tools/testing/nvdimm/pmem-dax.c | 12 +-
tools/testing/selftests/bpf/test_verifier.c | 6 +-
129 files changed, 1473 insertions(+), 1362 deletions(-)
In order for ULPI PHYs to work, dwc3_phy_setup() and dwc3_ulpi_init()
must be doene before dwc3_core_get_phy().
commit 541768b08a40 ("usb: dwc3: core: Call dwc3_core_get_phy() before initializing phys")
broke this.
The other issue is that dwc3_core_get_phy() and dwc3_ulpi_init() should
be called only once during the life cycle of the driver. However,
as dwc3_core_init() is called during system suspend/resume it will
result in multiple calls to dwc3_core_get_phy() and dwc3_ulpi_init()
which is wrong.
Fix this by moving dwc3_ulpi_init() out of dwc3_phy_setup()
into dwc3_core_ulpi_init(). Use a flag 'ulpi_ready' to ensure that
dwc3_core_ulpi_init() is called only once from dwc3_core_init().
Use another flag 'phys_ready' to call dwc3_core_get_phy() only once from
dwc3_core_init().
Fixes: 541768b08a40 ("usb: dwc3: core: Call dwc3_core_get_phy() before initializing phys")
Fixes: f54edb539c11 ("usb: dwc3: core: initialize ULPI before trying to get the PHY")
Cc: linux-stable <stable(a)vger.kernel.org> # >= v4.13
Signed-off-by: Roger Quadros <rogerq(a)ti.com>
---
Changelog:
v2:
- don't break ULPI case. Also take into consideration suspend/resume for ULPI case.
drivers/usb/dwc3/core.c | 47 ++++++++++++++++++++++++++++++++++++-----------
drivers/usb/dwc3/core.h | 5 +++++
2 files changed, 41 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 0783250..84382f6 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -482,6 +482,22 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc)
parms->hwparams8 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS8);
}
+static int dwc3_core_ulpi_init(struct dwc3 *dwc)
+{
+ int intf;
+ int ret = 0;
+
+ intf = DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3);
+
+ if (intf == DWC3_GHWPARAMS3_HSPHY_IFC_ULPI ||
+ (intf == DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI &&
+ dwc->hsphy_interface &&
+ !strncmp(dwc->hsphy_interface, "ulpi", 4)))
+ ret = dwc3_ulpi_init(dwc);
+
+ return ret;
+}
+
/**
* dwc3_phy_setup - Configure USB PHY Interface of DWC3 Core
* @dwc: Pointer to our controller context structure
@@ -493,7 +509,6 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc)
static int dwc3_phy_setup(struct dwc3 *dwc)
{
u32 reg;
- int ret;
reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
@@ -564,9 +579,6 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
}
/* FALLTHROUGH */
case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI:
- ret = dwc3_ulpi_init(dwc);
- if (ret)
- return ret;
/* FALLTHROUGH */
default:
break;
@@ -723,6 +735,7 @@ static void dwc3_core_setup_global_control(struct dwc3 *dwc)
}
static int dwc3_core_get_phy(struct dwc3 *dwc);
+static int dwc3_core_ulpi_init(struct dwc3 *dwc);
/**
* dwc3_core_init - Low-level initialization of DWC3 Core
@@ -754,17 +767,27 @@ static int dwc3_core_init(struct dwc3 *dwc)
dwc->maximum_speed = USB_SPEED_HIGH;
}
- ret = dwc3_core_get_phy(dwc);
+ ret = dwc3_phy_setup(dwc);
if (ret)
goto err0;
- ret = dwc3_core_soft_reset(dwc);
- if (ret)
- goto err0;
+ if (!dwc->ulpi_ready) {
+ ret = dwc3_core_ulpi_init(dwc);
+ if (ret)
+ goto err0;
+ dwc->ulpi_ready = true;
+ }
- ret = dwc3_phy_setup(dwc);
+ if (!dwc->phys_ready) {
+ ret = dwc3_core_get_phy(dwc);
+ if (ret)
+ goto err0a;
+ dwc->phys_ready = true;
+ }
+
+ ret = dwc3_core_soft_reset(dwc);
if (ret)
- goto err0;
+ goto err0a;
dwc3_core_setup_global_control(dwc);
dwc3_core_num_eps(dwc);
@@ -837,6 +860,9 @@ static int dwc3_core_init(struct dwc3 *dwc)
phy_exit(dwc->usb2_generic_phy);
phy_exit(dwc->usb3_generic_phy);
+err0a:
+ dwc3_ulpi_exit(dwc);
+
err0:
return ret;
}
@@ -1229,7 +1255,6 @@ static int dwc3_probe(struct platform_device *pdev)
err3:
dwc3_free_event_buffers(dwc);
- dwc3_ulpi_exit(dwc);
err2:
pm_runtime_allow(&pdev->dev);
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 4a4a4c9..6b202e3 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -795,7 +795,9 @@ struct dwc3_scratchpad_array {
* @usb3_phy: pointer to USB3 PHY
* @usb2_generic_phy: pointer to USB2 PHY
* @usb3_generic_phy: pointer to USB3 PHY
+ * @phys_ready: flag to indicate that PHYs are ready
* @ulpi: pointer to ulpi interface
+ * @ulpi_ready: flag to indicate that ULPI is initialized
* @isoch_delay: wValue from Set Isochronous Delay request;
* @u2sel: parameter from Set SEL request.
* @u2pel: parameter from Set SEL request.
@@ -893,7 +895,10 @@ struct dwc3 {
struct phy *usb2_generic_phy;
struct phy *usb3_generic_phy;
+ bool phys_ready;
+
struct ulpi *ulpi;
+ bool ulpi_ready;
void __iomem *regs;
size_t regs_size;
--
cheers,
-roger
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Hi,
that patch is not 100% correct. You can revert it in your tree. I added
that because of a problem I found when running adb against macOS.
It's actually okay to send Clear Halt at any time, but for some reason
dwc3 was hanging when running adb against macOS.
If you can revert the patch and make sure it works against all 3 major
OSes (linux, windows and mac) I'd be really glad.
liangshengjun <liangshengjun(a)hisilicon.com> writes:
> Hi felipe,
>
> I have met a case about set/clear Halt patch
> Version: linux v4.16,
> Case: usb uvc run with bulk-mode connect to Windows 7 PC. When PC stop camera application , it would send clearHalt request to uvc device to streaming-off video transfer.
> But with v4.16 dwc3 drivers, it would skip handling this clear Halt request , because dep->flags is not DWC3_EP_STALL status, then it causes PC restart camera application , uvc transfer fail.
> And I have confirmed v3.18 dwc3 drivers is OK.
>
> So how to balance for handling clear Halt without first setHalt ??
>
> PS:
> commit ffb80fc672c3a7b6afd0cefcb1524fb99917b2f3
> Author: Felipe Balbi <felipe.balbi(a)linux.intel.com>
> Date: Thu Jan 19 13:38:42 2017 +0200
>
> usb: dwc3: gadget: skip Set/Clear Halt when invalid
>
> At least macOS seems to be sending
> ClearFeature(ENDPOINT_HALT) to endpoints which
> aren't Halted. This makes DWC3's CLEARSTALL command
> time out which causes several issues for the driver.
>
> Instead, let's just return 0 and bail out early.
>
> Cc: <stable(a)vger.kernel.org>
> Signed-off-by: Felipe Balbi <felipe.balbi(a)linux.intel.com>
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 6faf484..0a664d8 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1379,6 +1379,9 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
> unsigned transfer_in_flight;
> unsigned started;
>
> + if (dep->flags & DWC3_EP_STALL)
> + return 0;
> +
> if (dep->number > 1)
> trb = dwc3_ep_prev_trb(dep, dep->trb_enqueue);
> else
> @@ -1400,6 +1403,8 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
> else
> dep->flags |= DWC3_EP_STALL;
> } else {
> + if (!(dep->flags & DWC3_EP_STALL))
> + return 0;
>
> ret = dwc3_send_clear_stall_ep_cmd(dep);
> if (ret)
>
>
> Liang Shengjun
> [cid:image001.png@01D40971.9265B340]
> HISILICON TECHNOLOGIES CO., LTD.
> New R&D Center, Wuhe Road, Bantian,
> Longgang District, Shenzhen 518129 P.R. China
>
--
balbi
Use the new of_get_compatible_child() helper to lookup the nfc child
node instead of using of_find_compatible_node(), which searches the
entire tree from a given start node and thus can return an unrelated
(i.e. non-child) node.
This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the node of the device being probed).
While at it, also fix a related nfc-node reference leak.
Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
Cc: stable <stable(a)vger.kernel.org> # 4.11
Cc: Nicolas Ferre <nicolas.ferre(a)microchip.com>
Cc: Josh Wu <rainyfeeling(a)outlook.com>
Cc: Boris Brezillon <boris.brezillon(a)bootlin.com>
Signed-off-by: Johan Hovold <johan(a)kernel.org>
---
drivers/mtd/nand/raw/atmel/nand-controller.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index a068b214ebaa..d3dfe63956ac 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -2061,8 +2061,7 @@ atmel_hsmc_nand_controller_legacy_init(struct atmel_hsmc_nand_controller *nc)
int ret;
nand_np = dev->of_node;
- nfc_np = of_find_compatible_node(dev->of_node, NULL,
- "atmel,sama5d3-nfc");
+ nfc_np = of_get_compatible_child(dev->of_node, "atmel,sama5d3-nfc");
nc->clk = of_clk_get(nfc_np, 0);
if (IS_ERR(nc->clk)) {
@@ -2472,15 +2471,19 @@ static int atmel_nand_controller_probe(struct platform_device *pdev)
}
if (caps->legacy_of_bindings) {
+ struct device_node *nfc_node;
u32 ale_offs = 21;
/*
* If we are parsing legacy DT props and the DT contains a
* valid NFC node, forward the request to the sama5 logic.
*/
- if (of_find_compatible_node(pdev->dev.of_node, NULL,
- "atmel,sama5d3-nfc"))
+ nfc_node = of_get_compatible_child(pdev->dev.of_node,
+ "atmel,sama5d3-nfc");
+ if (nfc_node) {
caps = &atmel_sama5_nand_caps;
+ of_node_put(nfc_node);
+ }
/*
* Even if the compatible says we are dealing with an
--
2.18.0