1. 23 10月, 2017 5 次提交
    • K
      ASoC: snd_soc_component_driver has non_legacy_dai_naming · 69941bab
      Kuninori Morimoto 提交于
      Codec will be replaced into Component, then Codec side
      doesn't use legacy_dai_naming on snd_soc_register_dais().
      
      This patch adds new non_legacy_dai_naming flag on Component driver
      and use converted its value for snd_soc_register_dais().
      
      When Codec is replaced into Component, Codec driver needs
      to have non_legacy_dai_naming = 1 flags.
      Existing CPU side of course doesn't have this flag, thus CPU calls
      it as true.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      69941bab
    • K
      ASoC: snd_soc_component_driver has endianness · 273d778e
      Kuninori Morimoto 提交于
      Codec will be replaced into Component, then Codec side only
      needs to call fixup_codec_formats() at this point.
      
      This patch adds new endianness flag on Component driver
      and call convert_endianness_formats() (= was fixup_codec_format())
      if endianness was true.
      
      When Codec is replaced into Component, Codec driver needs
      to have endianness = 1 flags.
      Existing CPU side of course doesn't have this flag, thus CPU doesn't
      call it.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      273d778e
    • K
      ASoC: snd_soc_component_driver has pmdown_time · fbb16563
      Kuninori Morimoto 提交于
      Current snd_soc_runtime_ignore_pmdown_time() tallys all Codec and
      CPU's "ignore_pmdown_time". Now, CPU (= via compoent)
      ignore_pmdown_time is fixed as "true". Codec's one is copied from Codec
      driver. This means Codec side default is "false".
      
      Current all Codec driver will be replaced into Component, thus, we can
      use for_each_rtdcom() for this totalization. This patch adds new
      "pmdown_time" on Component driver. Its inverted value will be used
      for this "ignore" totalizaton.
      
      Of course all existing Component driver doesn't have its settings now,
      thus, all existing "pmdown_time" is "false". This means all
      Components will ignore pmdown time. This is current CPU behavior.
      To keep compatibility, snd_soc_runtime_ignore_pmdown_time() totalize
      Component's inverted "pmdown_time" (= total will be true) and
      Codec's "ignore_pmdown_time" (= depends on Codec driver settings).
      Because It is using AND operation, its result is based on Codec driver
      settings only.
      This means this operation can keep compatibility and doesn't have
      nonconformity.
      
      When we replace Codec to Component, the driver which has
      ".ignore_pmdown_time = true" will be just removed,
      and the driver which doesn't have it will have new
      ".pmdown_time = true".
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      fbb16563
    • K
      ASoC: snd_soc_component_driver has snd_compr_ops · 9e7e3738
      Kuninori Morimoto 提交于
      Platform will be replaced into Component in the future.
      snd_soc_platform_driver has snd_compr_ops, but snd_soc_component_driver
      doesn't have. To prepare for replacing, this patch adds snd_compr_ops on
      component driver.
      
      platform will be replaced into component, and its code will be removed.
      But during replacing, both platform and component process code exists.
      To keep compatibility, to avoid platform NULL access and to avoid
      platform/component duplicate operation during replacing process, this
      patch has such code. Some of this code will be removed when platform was
      removed.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      9e7e3738
    • K
      ASoC: snd_soc_component_driver has snd_pcm_ops · b8135864
      Kuninori Morimoto 提交于
      Platform will be replaced into Component in the future.
      snd_soc_platform_driver has snd_pcm_ops, but snd_soc_component_driver
      doesn't have it. To prepare for replacing, this patch adds snd_pcm_ops
      on component driver.
      
      platform will be replaced into component, and its code will be removed.
      But during replacing, both platform and component process code exists.
      To keep compatibility, to avoid platform NULL access and to avoid
      platform/component duplicate operation during replacing process, this
      patch has such code. Some of this code will be removed when platform was
      removed.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      b8135864
  2. 10 10月, 2017 1 次提交
  3. 04 10月, 2017 1 次提交
    • K
      ASoC: soc-core: add component lookup functions · 7dd5d0d9
      Kuninori Morimoto 提交于
      ALSA SoC platform/codec will be replaced to component soon.
      This means 1 device might have multiple components. But current
      unregister component function only checks "dev" to find it.
      This means, unexpected component might be unregistered by current
      function.
      But, it is no problem if driver registered only 1 component.
      
      To prepare avoid this issue, this patch adds new component
      lookup function. it finds component by "dev" and "driver name".
      
      Here, the reason why it uses "driver name" is that "component name"
      was created by fmt_single_name() and difficult to use it from driver.
      Driver of course knows its "driver name", thus, using it is more easy.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      7dd5d0d9
  4. 28 9月, 2017 2 次提交
    • K
      ASoC: add Component level set_bias_level · 7ba236ce
      Kuninori Morimoto 提交于
      In current ALSA SoC, Codec only has set_bias_level feature.
      Codec will be merged into Component in next generation ALSA SoC,
      thus current Codec specific feature need to be merged into it.
      This is glue patch for it.
      
      Codec driver has .idle_bias_off for dapm bias. But Component
      driver doesn't have it, and dapm->idle_bias_off is set as "true".
      To keep compatibility, this patch adds "idle_bias_on" instead of
      ".idle_bias_off" on Component driver.
      dapm->idle_bias_off will be set by inverted idle_bias_on.
      
      When we replace Codec to Component, the driver which has
      ".idle_bias_off = true" is just remove it,
      and the driver which doesn't have it will have new
      ".idle_bias_on = true".
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      7ba236ce
    • K
      ASoC: add Component level pcm_new/pcm_free v2 · f523aceb
      Kuninori Morimoto 提交于
      In current ALSA SoC, Platform only has pcm_new/pcm_free feature,
      but it should be supported on Component level. This patch adds it.
      
      The v1 was added commit 99b04f4c ("ASoC: add Component level
      pcm_new/pcm_free") but it called all "card" connected component's
      pcm_new/free, it was wrong.
      This patch calls "rtd" connected component.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      f523aceb
  5. 20 9月, 2017 1 次提交
  6. 16 9月, 2017 1 次提交
    • X
      sctp: fix an use-after-free issue in sctp_sock_dump · d25adbeb
      Xin Long 提交于
      Commit 86fdb344 ("sctp: ensure ep is not destroyed before doing the
      dump") tried to fix an use-after-free issue by checking !sctp_sk(sk)->ep
      with holding sock and sock lock.
      
      But Paolo noticed that endpoint could be destroyed in sctp_rcv without
      sock lock protection. It means the use-after-free issue still could be
      triggered when sctp_rcv put and destroy ep after sctp_sock_dump checks
      !ep, although it's pretty hard to reproduce.
      
      I could reproduce it by mdelay in sctp_rcv while msleep in sctp_close
      and sctp_sock_dump long time.
      
      This patch is to add another param cb_done to sctp_for_each_transport
      and dump ep->assocs with holding tsp after jumping out of transport's
      traversal in it to avoid this issue.
      
      It can also improve sctp diag dump to make it run faster, as no need
      to save sk into cb->args[5] and keep calling sctp_for_each_transport
      any more.
      
      This patch is also to use int * instead of int for the pos argument
      in sctp_for_each_transport, which could make postion increment only
      in sctp_for_each_transport and no need to keep changing cb->args[2]
      in sctp_sock_filter and sctp_sock_dump any more.
      
      Fixes: 86fdb344 ("sctp: ensure ep is not destroyed before doing the dump")
      Reported-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Acked-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d25adbeb
  7. 15 9月, 2017 5 次提交
  8. 14 9月, 2017 2 次提交
    • M
      mm: treewide: remove GFP_TEMPORARY allocation flag · 0ee931c4
      Michal Hocko 提交于
      GFP_TEMPORARY was introduced by commit e12ba74d ("Group short-lived
      and reclaimable kernel allocations") along with __GFP_RECLAIMABLE.  It's
      primary motivation was to allow users to tell that an allocation is
      short lived and so the allocator can try to place such allocations close
      together and prevent long term fragmentation.  As much as this sounds
      like a reasonable semantic it becomes much less clear when to use the
      highlevel GFP_TEMPORARY allocation flag.  How long is temporary? Can the
      context holding that memory sleep? Can it take locks? It seems there is
      no good answer for those questions.
      
      The current implementation of GFP_TEMPORARY is basically GFP_KERNEL |
      __GFP_RECLAIMABLE which in itself is tricky because basically none of
      the existing caller provide a way to reclaim the allocated memory.  So
      this is rather misleading and hard to evaluate for any benefits.
      
      I have checked some random users and none of them has added the flag
      with a specific justification.  I suspect most of them just copied from
      other existing users and others just thought it might be a good idea to
      use without any measuring.  This suggests that GFP_TEMPORARY just
      motivates for cargo cult usage without any reasoning.
      
      I believe that our gfp flags are quite complex already and especially
      those with highlevel semantic should be clearly defined to prevent from
      confusion and abuse.  Therefore I propose dropping GFP_TEMPORARY and
      replace all existing users to simply use GFP_KERNEL.  Please note that
      SLAB users with shrinkers will still get __GFP_RECLAIMABLE heuristic and
      so they will be placed properly for memory fragmentation prevention.
      
      I can see reasons we might want some gfp flag to reflect shorterm
      allocations but I propose starting from a clear semantic definition and
      only then add users with proper justification.
      
      This was been brought up before LSF this year by Matthew [1] and it
      turned out that GFP_TEMPORARY really doesn't have a clear semantic.  It
      seems to be a heuristic without any measured advantage for most (if not
      all) its current users.  The follow up discussion has revealed that
      opinions on what might be temporary allocation differ a lot between
      developers.  So rather than trying to tweak existing users into a
      semantic which they haven't expected I propose to simply remove the flag
      and start from scratch if we really need a semantic for short term
      allocations.
      
      [1] http://lkml.kernel.org/r/20170118054945.GD18349@bombadil.infradead.org
      
      [akpm@linux-foundation.org: fix typo]
      [akpm@linux-foundation.org: coding-style fixes]
      [sfr@canb.auug.org.au: drm/i915: fix up]
        Link: http://lkml.kernel.org/r/20170816144703.378d4f4d@canb.auug.org.au
      Link: http://lkml.kernel.org/r/20170728091904.14627-1-mhocko@kernel.orgSigned-off-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Acked-by: NMel Gorman <mgorman@suse.de>
      Acked-by: NVlastimil Babka <vbabka@suse.cz>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Neil Brown <neilb@suse.de>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0ee931c4
    • D
      sctp: potential read out of bounds in sctp_ulpevent_type_enabled() · fa5f7b51
      Dan Carpenter 提交于
      This code causes a static checker warning because Smatch doesn't trust
      anything that comes from skb->data.  I've reviewed this code and I do
      think skb->data can be controlled by the user here.
      
      The sctp_event_subscribe struct has 13 __u8 fields and we want to see
      if ours is non-zero.  sn_type can be any value in the 0-USHRT_MAX range.
      We're subtracting SCTP_SN_TYPE_BASE which is 1 << 15 so we could read
      either before the start of the struct or after the end.
      
      This is a very old bug and it's surprising that it would go undetected
      for so long but my theory is that it just doesn't have a big impact so
      it would be hard to notice.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fa5f7b51
  9. 13 9月, 2017 1 次提交
    • C
      net_sched: get rid of tcfa_rcu · d7fb60b9
      Cong Wang 提交于
      gen estimator has been rewritten in commit 1c0d32fd
      ("net_sched: gen_estimator: complete rewrite of rate estimators"),
      the caller is no longer needed to wait for a grace period.
      So this patch gets rid of it.
      
      This also completely closes a race condition between action free
      path and filter chain add/remove path for the following patch.
      Because otherwise the nested RCU callback can't be caught by
      rcu_barrier().
      
      Please see also the comments in code.
      
      Cc: Jiri Pirko <jiri@mellanox.com>
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d7fb60b9
  10. 12 9月, 2017 4 次提交
  11. 11 9月, 2017 2 次提交
    • G
      block: tolerate tracing of NULL bio · f8e9ec16
      Greg Thelen 提交于
      __get_request() can call trace_block_getrq() with bio=NULL which causes
      block_get_rq::TP_fast_assign() to deref a NULL pointer and panic.
      
      Syzkaller fuzzer panics with
      linux-next (1d53d908b79d7870d89063062584eead4cf83448):
        kasan: GPF could be caused by NULL-ptr deref or user memory access
        general protection fault: 0000 [#1] SMP KASAN
        Modules linked in:
        CPU: 0 PID: 2983 Comm: syzkaller401111 Not tainted 4.13.0-rc7-next-20170901+ #13
        task: ffff8801cf1da000 task.stack: ffff8801ce440000
        RIP: 0010:perf_trace_block_get_rq+0x697/0x970 include/trace/events/block.h:384
        RSP: 0018:ffff8801ce4473f0 EFLAGS: 00010246
        RAX: ffff8801cf1da000 RBX: 1ffff10039c88e84 RCX: 1ffffd1ffff84d27
        RDX: dffffc0000000001 RSI: 1ffff1003b643e7a RDI: ffffe8ffffc26938
        RBP: ffff8801ce447530 R08: 1ffff1003b643e6c R09: ffffe8ffffc26964
        R10: 0000000000000002 R11: fffff91ffff84d2d R12: ffffe8ffffc1f890
        R13: ffffe8ffffc26930 R14: ffffffff85cad9e0 R15: 0000000000000000
        FS:  0000000002641880(0000) GS:ffff8801db200000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 000000000043e670 CR3: 00000001d1d7a000 CR4: 00000000001406f0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
          trace_block_getrq include/trace/events/block.h:423 [inline]
          __get_request block/blk-core.c:1283 [inline]
          get_request+0x1518/0x23b0 block/blk-core.c:1355
          blk_old_get_request block/blk-core.c:1402 [inline]
          blk_get_request+0x1d8/0x3c0 block/blk-core.c:1427
          sg_scsi_ioctl+0x117/0x750 block/scsi_ioctl.c:451
          sg_ioctl+0x192d/0x2ed0 drivers/scsi/sg.c:1070
          vfs_ioctl fs/ioctl.c:45 [inline]
          do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
          SYSC_ioctl fs/ioctl.c:700 [inline]
          SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
          entry_SYSCALL_64_fastpath+0x1f/0xbe
      
      block_get_rq::TP_fast_assign() has multiple redundant ->dev assignments.
      Only one of them is NULL tolerant.  Favor the NULL tolerant one.
      
      Fixes: 74d46992 ("block: replace bi_bdev with a gendisk pointer and partitions index")
      Reviewed-by: NMing Lei <ming.lei@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NGreg Thelen <gthelen@google.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      f8e9ec16
    • M
      dax: remove the pmem_dax_ops->flush abstraction · c3ca015f
      Mikulas Patocka 提交于
      Commit abebfbe2 ("dm: add ->flush() dax operation support") is
      buggy. A DM device may be composed of multiple underlying devices and
      all of them need to be flushed. That commit just routes the flush
      request to the first device and ignores the other devices.
      
      It could be fixed by adding more complex logic to the device mapper. But
      there is only one implementation of the method pmem_dax_ops->flush - that
      is pmem_dax_flush() - and it calls arch_wb_cache_pmem(). Consequently, we
      don't need the pmem_dax_ops->flush abstraction at all, we can call
      arch_wb_cache_pmem() directly from dax_flush() because dax_dev->ops->flush
      can't ever reach anything different from arch_wb_cache_pmem().
      
      It should be also pointed out that for some uses of persistent memory it
      is needed to flush only a very small amount of data (such as 1 cacheline),
      and it would be overkill if we go through that device mapper machinery for
      a single flushed cache line.
      
      Fix this by removing the pmem_dax_ops->flush abstraction and call
      arch_wb_cache_pmem() directly from dax_flush(). Also, remove the device
      mapper code that forwards the flushes.
      
      Fixes: abebfbe2 ("dm: add ->flush() dax operation support")
      Cc: stable@vger.kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      c3ca015f
  12. 09 9月, 2017 15 次提交