21 Jan, 2020

1 commit


02 Dec, 2019

1 commit

  • Pull rpmsg updates from Bjorn Andersson:
    "This contains a number of bug fixes to the GLINK transport driver, an
    off-by-one in the GLINK smem driver and a memory leak fix in the rpmsg
    char driver"

    * tag 'rpmsg-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc:
    rpmsg: Fix Kconfig indentation
    rpmsg: char: Simplify 'rpmsg_eptdev_release()'
    rpmsg: glink: Free pending deferred work on remove
    rpmsg: glink: Don't send pending rx_done during remove
    rpmsg: glink: Fix rpmsg_register_device err handling
    rpmsg: glink: Put an extra reference during cleanup
    rpmsg: glink: Fix use after free in open_ack TIMEOUT case
    rpmsg: glink: Fix reuse intents memory leak issue
    rpmsg: glink: Set tail pointer to 0 at end of FIFO
    rpmsg: char: release allocated memory

    Linus Torvalds
     

22 Nov, 2019

1 commit

  • Adjust indentation from spaces to tab (+optional two spaces) as in
    coding style with command like:
    $ sed -e 's/^ /\t/' -i */Kconfig

    Signed-off-by: Krzysztof Kozlowski
    Link: https://lore.kernel.org/r/20191120133945.13938-1-krzk@kernel.org
    Signed-off-by: Bjorn Andersson

    Krzysztof Kozlowski
     

09 Nov, 2019

1 commit


23 Oct, 2019

1 commit

  • The .ioctl and .compat_ioctl file operations have the same prototype so
    they can both point to the same function, which works great almost all
    the time when all the commands are compatible.

    One exception is the s390 architecture, where a compat pointer is only
    31 bit wide, and converting it into a 64-bit pointer requires calling
    compat_ptr(). Most drivers here will never run in s390, but since we now
    have a generic helper for it, it's easy enough to use it consistently.

    I double-checked all these drivers to ensure that all ioctl arguments
    are used as pointers or are ignored, but are not interpreted as integer
    values.

    Acked-by: Jason Gunthorpe
    Acked-by: Daniel Vetter
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Greg Kroah-Hartman
    Acked-by: David Sterba
    Acked-by: Darren Hart (VMware)
    Acked-by: Jonathan Cameron
    Acked-by: Bjorn Andersson
    Acked-by: Dan Williams
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

17 Oct, 2019

6 commits

  • By just cancelling the deferred rx worker during GLINK instance teardown
    any pending deferred commands are leaked, so free them.

    Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
    Cc: stable@vger.kernel.org
    Acked-by: Chris Lew
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • Attempting to transmit rx_done messages after the GLINK instance is
    being torn down will cause use after free and memory leaks. So cancel
    the intent_work and free up the pending intents.

    With this there are no concurrent accessors of the channel left during
    qcom_glink_native_remove() and there is therefor no need to hold the
    spinlock during this operation - which would prohibit the use of
    cancel_work_sync() in the release function. So remove this.

    Fixes: 1d2ea36eead9 ("rpmsg: glink: Add rx done command")
    Cc: stable@vger.kernel.org
    Acked-by: Chris Lew
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • The device release function is set before registering with rpmsg. If
    rpmsg registration fails, the framework will call device_put(), which
    invokes the release function. The channel create logic does not need to
    free rpdev if rpmsg_register_device() fails and release is called.

    Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
    Cc: stable@vger.kernel.org
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Chris Lew
    Signed-off-by: Bjorn Andersson

    Chris Lew
     
  • In a remote processor crash scenario, there is no guarantee the remote
    processor sent close requests before it went into a bad state. Remove
    the reference that is normally handled by the close command in the
    so channel resources can be released.

    Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
    Cc: stable@vger.kernel.org
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Chris Lew
    Reported-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Chris Lew
     
  • Extra channel reference put when remote sending OPEN_ACK after timeout
    causes use-after-free while handling next remote CLOSE command.

    Remove extra reference put in timeout case to avoid use-after-free.

    Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
    Cc: stable@vger.kernel.org
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Arun Kumar Neelakantam
    Signed-off-by: Bjorn Andersson

    Arun Kumar Neelakantam
     
  • Memory allocated for re-usable intents are not freed during channel
    cleanup which causes memory leak in system.

    Check and free all re-usable memory to avoid memory leak.

    Fixes: 933b45da5d1d ("rpmsg: glink: Add support for TX intents")
    Cc: stable@vger.kernel.org
    Acked-By: Chris Lew
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Arun Kumar Neelakantam
    Reported-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Arun Kumar Neelakantam
     

12 Oct, 2019

1 commit

  • When wrapping around the FIFO, the remote expects the tail pointer to
    be reset to 0 on the edge case where the tail equals the FIFO length.

    Fixes: caf989c350e8 ("rpmsg: glink: Introduce glink smem based transport")
    Cc: stable@vger.kernel.org
    Signed-off-by: Chris Lew
    Signed-off-by: Bjorn Andersson

    Chris Lew
     

05 Oct, 2019

1 commit


18 Sep, 2019

1 commit

  • Naming the glink edge device on the parent of_node short name causes
    collisions when multiple remoteproc instances with only different unit
    address are described on the platform_bus in DeviceTree.

    Base the edge's name on the parent remoteproc's name instead, to ensure
    that it's unique.

    Reviewed-by: Niklas Cassel
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     

30 Aug, 2019

1 commit

  • One of the more common cases of allocation size calculations is finding
    the size of a structure that has a zero-sized array at the end, along
    with memory for some number of elements for that array. For example:

    struct {
    ...
    struct intent_pair intents[];
    } __packed * msg;

    Make use of the struct_size() helper instead of an open-coded version
    in order to avoid any potential type mistakes.

    So, replace the following form:

    sizeof(*msg) + sizeof(struct intent_pair) * count

    with:

    struct_size(msg, intents, count)

    This code was detected with the help of Coccinelle.

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Bjorn Andersson

    Gustavo A. R. Silva
     

28 Aug, 2019

1 commit

  • The virtio_rpmsg_bus driver uses the "%p" format-specifier for
    printing the vring buffer address. This prints only a hashed
    pointer even for previliged users. Use "%pK" instead so that
    the address can be printed during debug using kptr_restrict
    sysctl.

    Signed-off-by: Suman Anna
    Signed-off-by: Bjorn Andersson

    Suman Anna
     

27 Aug, 2019

1 commit


22 May, 2019

1 commit


21 Feb, 2019

2 commits


04 Oct, 2018

1 commit


28 Sep, 2018

1 commit

  • Currently a failed allocation of channel->name leads to an
    immediate return without freeing channel. Fix this by setting
    ret to -ENOMEM and jumping to an exit path that kfree's channel.

    Detected by CoverityScan, CID#1473692 ("Resource Leak")

    Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend")
    Cc: stable@vger.kernel.org
    Signed-off-by: Colin Ian King
    Signed-off-by: Bjorn Andersson

    Colin Ian King
     

02 Sep, 2018

1 commit

  • It is possible for the chunk sizes coming from the non RPM remote procs
    to not be word aligned. Remove the alignment warning and continue to
    read from the FIFO so execution is not stalled.

    Signed-off-by: Chris Lew
    Signed-off-by: Arun Kumar Neelakantam
    Signed-off-by: Bjorn Andersson

    Chris Lew
     

28 Aug, 2018

2 commits


31 Jul, 2018

6 commits

  • Add compat ioctl callback to support 32bit user space applications.

    Signed-off-by: Arun Kumar Neelakantam
    Signed-off-by: Bjorn Andersson

    Arun Kumar Neelakantam
     
  • Channels may need to identify the edge their channel was probed for.
    Store the edge name by reading the label property from device tree or
    default to the node name.

    Signed-off-by: Chris Lew
    Signed-off-by: Arun Kumar Neelakantam
    Signed-off-by: Bjorn Andersson

    Chris Lew
     
  • Some of the rpmsg devices need to switch on power domains to communicate
    with remote processor. For example on Qualcomm DB820c platform LPASS
    power domain needs to switched on for any kind of audio services.
    This patch adds the missing power domain support in rpmsg core.

    Without this patch attempting to play audio via QDSP on DB820c would
    reboot the system.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     
  • This patch fixes below kerneldoc warnings

    qcom_smd.c:141: warning: Function parameter or member 'dev' not described in 'qcom_smd_edge'
    qcom_smd.c:141: warning: Function parameter or member 'name' not described in 'qcom_smd_edge'
    qcom_smd.c:141: warning: Function parameter or member 'new_channel_event' not described in 'qcom_smd_edge'
    qcom_smd.c:222: warning: Function parameter or member 'qsept' not described in 'qcom_smd_channel'
    qcom_smd.c:222: warning: Function parameter or member 'registered' not described in 'qcom_smd_channel'
    qcom_smd.c:222: warning: Function parameter or member 'state_change_event' not described in 'qcom_smd_channel'
    qcom_smd.c:222: warning: Function parameter or member 'drvdata' not described in 'qcom_smd_channel'
    qcom_smd.c:737: warning: Function parameter or member 'wait' not described in '__qcom_smd_send'

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     
  • Fix below kerneldoc warnings while building with W=1
    qcom_glink_native.c:53: warning: Function parameter or member 'data' not described in 'glink_defer_cmd'
    qcom_glink_native.c:75: warning: Function parameter or member 'data' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'id' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'size' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'reuse' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'in_use' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'offset' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'node' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:116: warning: Function parameter or member 'features' not described in 'qcom_glink'
    qcom_glink_native.c:116: warning: Function parameter or member 'intentless' not described in 'qcom_glink'
    qcom_glink_native.c:524: warning: Function parameter or member 'version' not described in 'qcom_glink_receive_version'
    qcom_glink_native.c:524: warning: Function parameter or member 'features' not described in 'qcom_glink_receive_version'
    qcom_glink_native.c:524: warning: Excess function parameter 'r_version' description in 'qcom_glink_receive_version'
    qcom_glink_native.c:524: warning: Excess function parameter 'r_features' description in 'qcom_glink_receive_version'
    qcom_glink_native.c:551: warning: Function parameter or member 'version' not described in 'qcom_glink_receive_version_ack'
    qcom_glink_native.c:551: warning: Function parameter or member 'features' not described in 'qcom_glink_receive_version_ack'
    qcom_glink_native.c:551: warning: Excess function parameter 'r_version' description in 'qcom_glink_receive_version_ack'
    qcom_glink_native.c:551: warning: Excess function parameter 'r_features' description in 'qcom_glink_receive_version_ack'
    qcom_glink_native.c:570: warning: bad line: wire format and transmit
    qcom_glink_native.c:604: warning: Function parameter or member 'intent' not described in 'qcom_glink_advertise_intent'
    qcom_glink_native.c:604: warning: Excess function parameter 'size' description in 'qcom_glink_advertise_intent'
    qcom_glink_native.c:710: warning: Function parameter or member 'glink' not described in 'qcom_glink_handle_intent_req'
    qcom_glink_native.c:710: warning: Function parameter or member 'cid' not described in 'qcom_glink_handle_intent_req'
    qcom_glink_native.c:710: warning: Function parameter or member 'size' not described in 'qcom_glink_handle_intent_req'

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     
  • As intent structure members are not correctly annotated, leading to below warnings

    qcom_glink_native.c:614:16: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:614:16: expected unsigned short [unsigned] [usertype] id
    qcom_glink_native.c:614:16: got restricted __le16 [usertype]
    qcom_glink_native.c:615:18: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:615:18: expected unsigned short [unsigned] [usertype] lcid
    qcom_glink_native.c:615:18: got restricted __le16 [usertype]
    qcom_glink_native.c:616:19: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:616:19: expected unsigned int [unsigned] [usertype] count
    qcom_glink_native.c:616:19: got restricted __le32 [usertype]
    qcom_glink_native.c:617:18: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:617:18: expected unsigned int [unsigned] [usertype] size
    qcom_glink_native.c:617:18: got restricted __le32 [usertype]
    qcom_glink_native.c:618:18: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:618:18: expected unsigned int [unsigned] [usertype] liid
    qcom_glink_native.c:618:18: got restricted __le32 [usertype]

    Fix this by correctly annotating them.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     

02 Jul, 2018

1 commit

  • Add missing include of sizes.h.

    drivers/rpmsg/qcom_smd.c: In function ‘qcom_smd_channel_open’:
    drivers/rpmsg/qcom_smd.c:809:36: error: ‘SZ_4K’ undeclared (first use in this function)
    bb_size = min(channel->fifo_size, SZ_4K);
    ^~~~~

    Signed-off-by: Niklas Cassel
    Signed-off-by: Bjorn Andersson

    Niklas Cassel
     

05 Jun, 2018

1 commit

  • All the managed resources would be freed by the time release function
    is invoked. Handling such memory in qcom_smd_edge_release() would do
    bad things.

    Found this issue while testing Audio usecase where the dsp is started up
    and shutdown in a loop.

    This patch fixes this issue by using simple kzalloc for allocating
    channel->name and channel which is then freed in qcom_smd_edge_release().

    Without this patch restarting a remoteproc would crash the system.
    Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend")
    Cc:
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     

04 Jun, 2018

5 commits


10 May, 2018

1 commit


26 Apr, 2018

1 commit