platform/kernel/linux-exynos.git
7 years agokmsg: selftests
Paul Osmialowski [Wed, 23 Sep 2015 16:04:13 +0000 (18:04 +0200)]
kmsg: selftests

This patch adds selftests framework and four test scenarios for kmsg.

The framework shape and code was inspired by similar selftests framework
for kdbus.

Change-Id: I4453105186c90430dcdb59d592392fbac05b42f5
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokmsg: add ioctl for kmsg* devices operating on buffers
Marcin Niesluchowski [Thu, 21 May 2015 14:24:30 +0000 (16:24 +0200)]
kmsg: add ioctl for kmsg* devices operating on buffers

There is no possibility to clear additional kmsg buffers,
get size of them or know what size should be passed to read
file operation (too small size causes it to retrun -EINVAL).

Add following ioctls which solve those issues:
* KMSG_CMD_GET_BUF_SIZE
* KMSG_CMD_GET_READ_SIZE_MAX
* KMSG_CMD_CLEAR

Change-Id: I7ee4c54495f6c4fd1458fd2998ffae0f3a8866c0
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
7 years agokmsg: add ioctl for adding and deleting kmsg* devices
Marcin Niesluchowski [Thu, 18 Jun 2015 09:31:00 +0000 (11:31 +0200)]
kmsg: add ioctl for adding and deleting kmsg* devices

There is no possibility to add/delete kmsg* buffers from userspace.

Adds following ioctl for main kmsg device adding and deleting
additional kmsg devices:
* KMSG_CMD_BUFFER_ADD
* KMSG_CMD_BUFFER_DEL

Change-Id: Ibc3c959957a545b09de4bbcb35533b690ba31fb5
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
7 years agokmsg: add predefined _PID, _TID, _COMM keywords to kmsg* log dict
Marcin Niesluchowski [Mon, 27 Apr 2015 09:20:34 +0000 (11:20 +0200)]
kmsg: add predefined _PID, _TID, _COMM keywords to kmsg* log dict

kmsg* devices write operation wrote no dict along with message
Due to usage of kmsg devices in userspace dict has been added
identifying pid, tid and comm of writing process.

Change-Id: I82fec61b012d3df5a5d5e4bd5c9999d92c32496d
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
7 years agokmsg: add function for adding and deleting additional buffers
Marcin Niesluchowski [Mon, 20 Apr 2015 11:03:10 +0000 (13:03 +0200)]
kmsg: add function for adding and deleting additional buffers

Additional kmsg buffers should be created and deleted dynamically.

Adding two functions
* kmsg_sys_buffer_add() creates additional kmsg buffer returning minor
* kmsg_sys_buffer_del() deletes one based on provided minor

Change-Id: Ibb85543b830ecd186e8cf7ebdf560f72c0bba83c
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
7 years agokmsg: add additional buffers support to memory class
Marcin Niesluchowski [Mon, 20 Jul 2015 12:52:06 +0000 (14:52 +0200)]
kmsg: add additional buffers support to memory class

Memory class does not support additional kmsg buffers.

Add additional kmsg buffers support to:
* devnode() callback of "mem" class
* file operations of major "mem" character device

Change-Id: I15b6c79435b4dc18422a9bd6836bd9c7a87ad60a
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
7 years agokmsg: introduce additional kmsg devices support
Marcin Niesluchowski [Wed, 29 Apr 2015 17:37:05 +0000 (19:37 +0200)]
kmsg: introduce additional kmsg devices support

kmsg device provides operations on cyclic logging buffer used mainly
by kernel but also in userspace by privileged processes.

Additional kmsg devices keep the same log format but may be added
dynamically with custom size.

Change-Id: I52c28310197594888621000bb5be933173c3031d
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
7 years agoprintk: add one function for storing log in proper format
Marcin Niesluchowski [Thu, 2 Jul 2015 14:54:51 +0000 (16:54 +0200)]
printk: add one function for storing log in proper format

Preparation commit for future changes purpose.

Separate code responsible for storing log message in proper format
from operations on consoles by putting it in another function.

Change-Id: I6d744bb83f8dd0e4ae5afe05bd082092e28082a9
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
7 years agoprintk: move code regarding log message storing format
Marcin Niesluchowski [Thu, 2 Jul 2015 14:32:28 +0000 (16:32 +0200)]
printk: move code regarding log message storing format

Preparation commit for future changes purpose.

Moves some code responsible for storing log messages in proper format.

Change-Id: I1df4bb2c1f2e7643129ba73e7355a0cfb7d511ca
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
7 years agoprintk: guard the amount written per line by devkmsg_read()
Tejun Heo [Thu, 14 May 2015 15:36:36 +0000 (11:36 -0400)]
printk: guard the amount written per line by devkmsg_read()

devkmsg_read() uses 8k buffer and assumes that the formatted output
message won't overrun which seems safe given LOG_LINE_MAX, the current
use of dict and the escaping method being used; however, we're
planning to use devkmsg formatting wider and accounting for the buffer
size properly isn't that complicated.

This patch defines CONSOLE_EXT_LOG_MAX as 8192 and updates
devkmsg_read() so that it limits output accordingly.

Change-Id: Ic8579ddcd55294a38561e9e8b28449c067600db1
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Kay Sievers <kay@vrfy.org>
Cc: Petr Mladek <pmladek@suse.cz>
7 years agokdbus: disable all internal policy checks
Lukasz Skalski [Mon, 4 Jan 2016 14:59:07 +0000 (15:59 +0100)]
kdbus: disable all internal policy checks

Change-Id: I5ef09ea4e4389ca41a6ef7afda31fe3a8d9bc507
Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
7 years agotools/build: fix build script to set proper kernel version to output
Seung-Woo Kim [Thu, 28 Jan 2016 00:50:33 +0000 (09:50 +0900)]
tools/build: fix build script to set proper kernel version to output

This patch fixes build script to set proper kernel version to output
image tar file.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoarm64: dts: exynos-5433-tm2e: fix touch resolution
Inki Dae [Wed, 27 Jan 2016 11:56:37 +0000 (20:56 +0900)]
arm64: dts: exynos-5433-tm2e: fix touch resolution

This patch fixes horizontal resolution to be suitable
to Note 4 edge Display.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agoarm64: dts: exynos5433-tm2e: Modify the different pmic setting from TM2
Chanwoo Choi [Wed, 27 Jan 2016 06:41:57 +0000 (15:41 +0900)]
arm64: dts: exynos5433-tm2e: Modify the different pmic setting from TM2

This patch modifies the different PMIC setting from TM2 board.
The following differences is trivial:
- Change the maximum voltage of LDO23, LDO31 and LDO38
- Don't use the LDO25

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoarm64: dts: Add new Exynos5433-based TM2E board dts
Chanwoo Choi [Wed, 27 Jan 2016 06:15:41 +0000 (15:15 +0900)]
arm64: dts: Add new Exynos5433-based TM2E board dts

This patch adds the new Exynos5433-based TM2E board which is Samsung Galaxy
Note4-Edge (SM-N915S).

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoRevert "local/rtc: s5m: Add support for S2MPS13 RTC"
Krzysztof Kozlowski [Wed, 30 Dec 2015 04:00:36 +0000 (13:00 +0900)]
Revert "local/rtc: s5m: Add support for S2MPS13 RTC"

This reverts commit 70deaddc2d5a8b3efed014f577473d24bedbfb96.

The offending commit was actually an invalid automatic resolution of
conflict (after rebasing on v4.1) and it is duplicating existing device
id entry.

7 years agovb2: Fix compilation breakage when !CONFIG_BUG
Laurent Pinchart [Sun, 12 Jul 2015 23:08:34 +0000 (20:08 -0300)]
vb2: Fix compilation breakage when !CONFIG_BUG

Commit 77a3c6fd90c9 ("[media] vb2: Don't WARN when v4l2_buffer.bytesused
is 0 for multiplanar buffers") uses the __WARN() macro which isn't
defined when CONFIG_BUG isn't set. This introduces a compilation
breakage. Fix it by using WARN_ON() instead.

The commit was also broken in that it merged v1 of the patch while a new
v2 version had been submitted, reviewed and acked. Fix it by
incorporating the changes from v1 to v2.

Fixes: 77a3c6fd90c9 ("[media] vb2: Don't WARN when v4l2_buffer.bytesused is 0 for multiplanar buffers")

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years agov4l2-ioctl: log buffer type 0 correctly
Hans Verkuil [Fri, 5 Jun 2015 14:28:51 +0000 (11:28 -0300)]
v4l2-ioctl: log buffer type 0 correctly

If userspace passed the invalid buffer type 0 to the kernel, then the
kernel log would show 'type=(null)' since there was no string defined
for type 0. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7 years agousb: gadget: composite: fill bcdUSB for any gadget max speed
Igor Kotrasinski [Thu, 20 Aug 2015 08:00:01 +0000 (10:00 +0200)]
usb: gadget: composite: fill bcdUSB for any gadget max speed

When handling device GET_DESCRIPTOR, composite gadget driver fills
the bcdUSB field only if the gadget supports USB 3.0. Otherwise
the field is left unfilled.

For consistency, set bcdUSB to 0x0200 for gadgets that don't
support superspeed.

It's correct to use 0x0200 for any setting that doesn't use
superspeed, since USB 2.0 devices can restrict themselves to
full speed only. It is NOT correct to use 0x0210, since BOS
descriptors are handled only if gadget_is_superspeed() is
satisfied, otherwise it results in a stall.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[Backported from mainline commit
5527e73305e8a9958b00331902a27514e62d539b]
Change-Id: Icd543a5b83c6b915be4ba54343ce979145f7e15d
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agodrm/exynos: fix imported dma-buf to be mapped
Joonyoung Shim [Tue, 22 Dec 2015 00:54:31 +0000 (09:54 +0900)]
drm/exynos: fix imported dma-buf to be mapped

The imported dma-buf should be mapped by sub-system exporting it.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[jy0922.shim: Be backported from upstream but not posted]

7 years agodrm/exynos: support mmap from dma-buf
Joonyoung Shim [Tue, 22 Dec 2015 00:50:10 +0000 (09:50 +0900)]
drm/exynos: support mmap from dma-buf

This allows exported dma-bufs to be mapped in exynos drm.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[jy0922.shim: Be backported from upstream but not posted]

7 years agodrm/exynos: remove call to drm_gem_free_mmap_offset()
Joonyoung Shim [Tue, 22 Dec 2015 00:35:55 +0000 (09:35 +0900)]
drm/exynos: remove call to drm_gem_free_mmap_offset()

The drm_gem_object_release() function already performs this cleanup,
so there is no reason to do it explicitly.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
[jy0922.shim: Be backported from upstream]

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agophy: Fix reset_reg offset for S5PV210 in phy-exynos-mipi-video.c
Sylwester Nawrocki [Thu, 5 Nov 2015 16:29:59 +0000 (17:29 +0100)]
phy: Fix reset_reg offset for S5PV210 in phy-exynos-mipi-video.c

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agofimc-is: Eliminate some BUG_ON() from fimc_is_group_buffer_finish()
Sylwester Nawrocki [Fri, 6 Nov 2015 13:33:22 +0000 (14:33 +0100)]
fimc-is: Eliminate some BUG_ON() from fimc_is_group_buffer_finish()

This prevents kernel panic caused by wrong sequences in user space.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: exynos5433: Fix mout_aclk_cam1*_user clocks definition
Sylwester Nawrocki [Fri, 6 Nov 2015 11:55:30 +0000 (12:55 +0100)]
clk: exynos5433: Fix mout_aclk_cam1*_user clocks definition

Control bits for the ACLK_CAM1_552_USER and ACLK_CAM1_400_USER
mux clocks are in MUX_SEL_CAM10, not MUX_SEL_CAM01 register.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoSmack: type confusion in smak sendmsg() handler
Roman Kubiak [Thu, 17 Dec 2015 12:24:35 +0000 (13:24 +0100)]
Smack: type confusion in smak sendmsg() handler

Smack security handler for sendmsg() syscall
is vulnerable to type confusion issue what
can allow to privilege escalation into root
or cause denial of service.

A malicious attacker can create socket of one
type for example AF_UNIX and pass is into
sendmsg() function ensuring that this is
AF_INET socket.

Remedy
Do not trust user supplied data.
Proposed fix below.

Signed-off-by: Roman Kubiak <r.kubiak@samsung.com>
Signed-off-by: Mateusz Fruba <m.fruba@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoSmack: File receive for sockets
Casey Schaufler [Mon, 7 Dec 2015 22:34:32 +0000 (14:34 -0800)]
Smack: File receive for sockets

The existing file receive hook checks for access on
the file inode even for UDS. This is not right, as
the inode is not used by Smack to make access checks
for sockets. This change checks for an appropriate
access relationship between the receiving (current)
process and the socket. If the process can't write
to the socket's send label or the socket's receive
label can't write to the process fail.

This will allow the legitimate cases, where the
socket sender and socket receiver can freely communicate.
Only strangly set socket labels should cause a problem.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoBluetooth: hci_uart: Fix dereferencing of ERR_PTR
Chan-yeol Park [Wed, 17 Jun 2015 12:10:39 +0000 (21:10 +0900)]
Bluetooth: hci_uart: Fix dereferencing of ERR_PTR

If h4_recv_buf() return ERR_PTR instead sk_buff pointer, it should be
cleared once PTR_ERR is completed for the further dereference such as
h4_recv(), or h4_close().

Signed-off-by: Chan-yeol Park <chanyeol.park@samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
7 years agoLOCAL / arm64: defconfig: enable zram feature
Seung-Woo Kim [Tue, 8 Dec 2015 01:11:28 +0000 (10:11 +0900)]
LOCAL / arm64: defconfig: enable zram feature

This patch enables zram feature which is used by Tizen resourced.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agos5p-mfc: remove volatile attribute from MFC register addresses
Andrzej Hajda [Tue, 1 Dec 2015 10:31:19 +0000 (11:31 +0100)]
s5p-mfc: remove volatile attribute from MFC register addresses

MFC register addresses are used only by writel/readl macros which already
takes care of proper register accessing.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agos5p-mfc: merge together s5p_mfc_hw_call and s5p_mfc_hw_call_void
Andrzej Hajda [Tue, 1 Dec 2015 09:24:23 +0000 (10:24 +0100)]
s5p-mfc: merge together s5p_mfc_hw_call and s5p_mfc_hw_call_void

Both macros can be merged into one.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agos5p-mfc: use spinlock to protect MFC context
Andrzej Hajda [Mon, 30 Nov 2015 13:02:52 +0000 (14:02 +0100)]
s5p-mfc: use spinlock to protect MFC context

MFC driver uses dev->irqlock spinlock to protect queues only, but many context
fields requires protection also - they can be accessed concurrently
from IOCTLs and IRQ handler. The patch increases protection range of irqlock
to those fields also.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agos5p-mfc: remove unnecessary callbacks
Andrzej Hajda [Fri, 20 Nov 2015 06:50:10 +0000 (07:50 +0100)]
s5p-mfc: remove unnecessary callbacks

Many version specific functions are not called by common code, so there
is no need to use callbacks. Additionally some of them are not used at all,
so they can be safely removed.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agos5p-mfc: make queue cleanup code common
Andrzej Hajda [Tue, 10 Nov 2015 11:48:25 +0000 (12:48 +0100)]
s5p-mfc: make queue cleanup code common

Code for queue cleanup has nothing specific to hardware version.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agos5p-mfc: use one implementation of s5p_mfc_get_new_ctx
Andrzej Hajda [Tue, 10 Nov 2015 11:35:12 +0000 (12:35 +0100)]
s5p-mfc: use one implementation of s5p_mfc_get_new_ctx

Both version of MFC driver uses functions with the same body and name.
The patch moves them to common location. It also simplifies it.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agomedia: s5p-mfc: remove double declared temporary variable
Marek Szyprowski [Tue, 24 Nov 2015 09:34:31 +0000 (10:34 +0100)]
media: s5p-mfc: remove double declared temporary variable

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 years agomedia: fimc-is: fix code issues pointed by CPPTest tool
Marek Szyprowski [Tue, 24 Nov 2015 09:33:57 +0000 (10:33 +0100)]
media: fimc-is: fix code issues pointed by CPPTest tool

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 years agosii8620: fix edid memory leak
Andrzej Hajda [Mon, 23 Nov 2015 13:30:51 +0000 (14:30 +0100)]
sii8620: fix edid memory leak

In case of error during edid retrieval, allocated memory should be freed.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
7 years agodrivers: soc/samsung: fix possible memory leak in pm_domains code
Marek Szyprowski [Mon, 23 Nov 2015 13:09:44 +0000 (14:09 +0100)]
drivers: soc/samsung: fix possible memory leak in pm_domains code

This patch fixes the issue pointed by Klocwork static analysis tool.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 years agomedia: fimc-is: fix possible memory leak found by static analysis
Marek Szyprowski [Mon, 23 Nov 2015 12:55:49 +0000 (13:55 +0100)]
media: fimc-is: fix possible memory leak found by static analysis

This patch fixes all issues pointed by Klocwork static analysis tool.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 years agokdbus: pool: use __vfs_read()
Sergei Zviagintsev [Thu, 23 Apr 2015 13:06:17 +0000 (15:06 +0200)]
kdbus: pool: use __vfs_read()

After commit 5d5d56897530 ("make new_sync_{read,write}() static")
->read() cannot be called directly.

kdbus_pool_slice_copy() leads to oops, which can be reproduced by
launching tools/testing/selftests/kdbus/kdbus-test -t message-quota:

[ 1167.146793] BUG: unable to handle kernel NULL pointer dereference at           (null)
[ 1167.147554] IP: [<          (null)>]           (null)
[ 1167.148670] PGD 3a9dd067 PUD 3a841067 PMD 0
[ 1167.149611] Oops: 0010 [#1] SMP
[ 1167.150088] Modules linked in: nfsv3 nfs kdbus lockd grace sunrpc
[ 1167.150771] CPU: 0 PID: 518 Comm: kdbus-test Not tainted 4.0.0-next-20150420-kdbus #62
[ 1167.150771] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 1167.150771] task: ffff88003daed120 ti: ffff88003a800000 task.ti: ffff88003a800000
[ 1167.150771] RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null)
[ 1167.150771] RSP: 0018:ffff88003a803bc0  EFLAGS: 00010286
[ 1167.150771] RAX: ffff8800377fb000 RBX: 00000000000201e8 RCX: ffff88003a803c00
[ 1167.150771] RDX: 0000000000000b40 RSI: ffff8800377fb4c0 RDI: ffff88003d815700
[ 1167.150771] RBP: ffff88003a803c48 R08: ffffffff8139e380 R09: ffff880039d80490
[ 1167.150771] R10: ffff88003a803a90 R11: 00000000000004c0 R12: 00000000002a24c0
[ 1167.150771] R13: 0000000000000b40 R14: ffff88003d815700 R15: ffffffff8139e460
[ 1167.150771] FS:  00007f41dccd4740(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
[ 1167.150771] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1167.150771] CR2: 0000000000000000 CR3: 000000003ccdf000 CR4: 00000000000007b0
[ 1167.150771] Stack:
[ 1167.150771]  ffffffffa0065497 ffff88003a803c10 00007ffffffff000 ffff88003aaa67c0
[ 1167.150771]  00000000000004c0 ffff88003aaa6870 ffff88003ca83300 ffffffffa006537d
[ 1167.150771]  00000000000201e8 ffffea0000ddfec0 ffff88003a803c20 0000000000000018
[ 1167.150771] Call Trace:
[ 1167.150771]  [<ffffffffa0065497>] ? kdbus_pool_slice_copy+0x127/0x200 [kdbus]
[ 1167.150771]  [<ffffffffa006537d>] ? kdbus_pool_slice_copy+0xd/0x200 [kdbus]
[ 1167.150771]  [<ffffffffa006670a>] kdbus_queue_entry_move+0xaa/0x180 [kdbus]
[ 1167.150771]  [<ffffffffa0059e64>] kdbus_conn_move_messages+0x1e4/0x2c0 [kdbus]
[ 1167.150771]  [<ffffffffa006234e>] kdbus_name_acquire+0x31e/0x390 [kdbus]
[ 1167.150771]  [<ffffffffa00625c5>] kdbus_cmd_name_acquire+0x125/0x130 [kdbus]
[ 1167.150771]  [<ffffffffa005db5d>] kdbus_handle_ioctl+0x4ed/0x610 [kdbus]
[ 1167.150771]  [<ffffffff811040e0>] do_vfs_ioctl+0x2e0/0x4e0
[ 1167.150771]  [<ffffffff81389750>] ? preempt_schedule_common+0x1f/0x3f
[ 1167.150771]  [<ffffffff8110431c>] SyS_ioctl+0x3c/0x80
[ 1167.150771]  [<ffffffff8138c36e>] system_call_fastpath+0x12/0x71
[ 1167.150771] Code:  Bad RIP value.
[ 1167.150771] RIP  [<          (null)>]           (null)
[ 1167.150771]  RSP <ffff88003a803bc0>
[ 1167.150771] CR2: 0000000000000000
[ 1167.168756] ---[ end trace a676bcfa75db5a96 ]---

Use __vfs_read() instead.

Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agolocal / arm64: tm2: Enable kdbus driver
Karol Lewandowski [Thu, 29 Oct 2015 12:06:19 +0000 (13:06 +0100)]
local / arm64: tm2: Enable kdbus driver

kdbus IPC will be only used when appropriate userspace is installed.

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
7 years agokdbus: disable internal kdbus policy
Lukasz Skalski [Mon, 24 Aug 2015 16:54:46 +0000 (18:54 +0200)]
kdbus: disable internal kdbus policy

Possibilities of connections to own, see and talk to well-known names
are already restricted by LSM hooks.

Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
7 years agokdbus: Eliminate warning caused by lack of uapi/linux/kdbus.h inclusion
Paul Osmialowski [Thu, 3 Sep 2015 14:38:42 +0000 (16:38 +0200)]
kdbus: Eliminate warning caused by lack of uapi/linux/kdbus.h inclusion

metadata.h references struct kdbus_pids which is defined in
uapi/linux/kdbus.h

Normally, kdbus/metadata.h is included as one of many other headers
that eventually include uapi/linux/kdbus.h at some point.

When included alone, it causes warning. Also when kdbus/connection.h
is included alone (e.g. in smack_lsm.c) , the same warning is shown
as it includes kdbus/metadata.h.

This patch adds missing inclusion.

Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: Ability to run kdbus test by executable binary name
Paul Osmialowski [Wed, 29 Apr 2015 10:00:19 +0000 (12:00 +0200)]
kdbus: Ability to run kdbus test by executable binary name

With this applied, you can do following:

$ cp kdbus-test daemon
$ cp kdbus-test send

Then run 'daemon' in one shell session:

$ ./daemon --bus test

...and 'send' in another:

$ ./send --bus test

Useful for testing features introduced by previous patches.

Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: selftests extended
Paul Osmialowski [Tue, 14 Apr 2015 13:55:09 +0000 (15:55 +0200)]
kdbus: selftests extended

The 'test-send' test case should connect to an already running test-daemon
which creates a bus with known name.

The main goal of this test case is to verify that messages as well as
file descriptors (opened with different open modes) can be transferred
properly.

In order to achieve its goals, this test case opens three files
(/tmp/kdbus-test-send.rd, /tmp/kdbus-test-send.wr,
/tmp/kdbus-test-send.rdwr) with three different open modes (O_RDONLY,
O_WRONLY, O_RDWR). If any of these files exists it is used 'as is',
otherwise it is created with some default content. Then this test tries
to send simple message followed by three messages each one of them
containing an array of opened file descriptors (single element array in the
first message, two element array in the second, three element array in the
third).

The ability to send array of file descriptors required changes in almost
all of the test case files.

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: TEST_CREATE_CONN now does no depend on TEST_CREATE_BUS
Paul Osmialowski [Wed, 29 Apr 2015 14:55:39 +0000 (16:55 +0200)]
kdbus: TEST_CREATE_CONN now does no depend on TEST_CREATE_BUS

Without this patch, it is impossible to specify test case able to
connect to a bus already created (e.g. by 'test-daemon' test case), you can
only specify:

1) TEST_CREATE_BUS which creates new bus, or
2) TEST_CREATE_CONN OR'ed with TEST_CREATE_BUS which creates new bus and
creates connection to it.

This patch adds the missing ability to specify TEST_CREATE_CONN alone.

It will be used by a new test case (will be added by separate commit) which
is supposed to connect to already started test-daemon case.

Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agolsm: smack: smack callbacks for kdbus security hooks
Paul Osmialowski [Tue, 23 Jun 2015 14:11:46 +0000 (16:11 +0200)]
lsm: smack: smack callbacks for kdbus security hooks

This adds implementation of three smack callbacks sitting behind kdbus
security hooks as proposed by Karol Lewandowski.

Originates from:

git://git.infradead.org/users/pcmoore/selinux (branch: working-kdbus)
commit: fc3505d058c001fe72a6f66b833e0be5b2d118f3

https://github.com/lmctl/linux.git (branch: kdbus-lsm-v4.for-systemd-v212)
commit: 103c26fd27d1ec8c32d85dd3d85681f936ac66fb

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: use LSM hooks in kdbus code
Paul Osmialowski [Tue, 26 May 2015 10:00:33 +0000 (12:00 +0200)]
kdbus: use LSM hooks in kdbus code

Originates from:

https://github.com/lmctl/kdbus.git (branch: kdbus-lsm-v4.for-systemd-v212)
commit: aa0885489d19be92fa41c6f0a71df28763228a40

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agolsm: kdbus security hooks
Paul Osmialowski [Tue, 26 May 2015 09:58:06 +0000 (11:58 +0200)]
lsm: kdbus security hooks

This is combination of work by Karol Lewandowski and Paul Moore
on LSM hooks for kdbus.

Originates from:

git://git.infradead.org/users/pcmoore/selinux (branch: working-kdbus)
commit: 7050f206a79564886938d0edc4e1e9da5972c72d

https://github.com/lmctl/linux.git (branch: kdbus-lsm-v4.for-systemd-v212)
commit: a9fe4c33b6e5ab25a243e0590df406aabb6add12

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agolsm: smack: Make ipc/kdbus includes visible so smack callbacks could see them
Paul Osmialowski [Tue, 26 May 2015 09:38:53 +0000 (11:38 +0200)]
lsm: smack: Make ipc/kdbus includes visible so smack callbacks could see them

Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agolsm: make security_file_receive available for external modules
Karol Lewandowski [Thu, 20 Feb 2014 16:54:38 +0000 (17:54 +0100)]
lsm: make security_file_receive available for external modules

This is required for using filedesc related LSM hooks in kdbus code
if it is built as a module.

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
7 years agokdbus: do not append the same connection to the queue twice
Paul Osmialowski [Thu, 18 Jun 2015 15:29:11 +0000 (17:29 +0200)]
kdbus: do not append the same connection to the queue twice

As it was discussed on systemd ML [1], the same connection should be
queued up only once for a given well-known name.

[1] http://lists.freedesktop.org/archives/systemd-devel/2015-April/030494.html

This commit fixes following issue:

[  243.364270] ------------[ cut here ]------------
[  243.364352] WARNING: CPU: 1 PID: 223 at ../ipc/kdbus/names.c:137 kdbus_name_entry_replace_owner+0x88/0x8c()
[  243.364408] Modules linked in:
[  243.364474] CPU: 1 PID: 223 Comm: kdbus-test Not tainted 4.0.0+ #1
[  243.364526] Hardware name: Foundation-v8A (DT)
[  243.364569] Call trace:
[  243.364639] [<ffff800000089d38>] dump_backtrace+0x0/0x12c
[  243.364718] [<ffff800000089e74>] show_stack+0x10/0x1c
[  243.364798] [<ffff8000006642f4>] dump_stack+0x74/0x98
[  243.364874] [<ffff8000000b282c>] warn_slowpath_common+0x98/0xd0
[  243.364951] [<ffff8000000b2928>] warn_slowpath_null+0x14/0x20
[  243.365026] [<ffff8000003cf7a4>] kdbus_name_entry_replace_owner+0x84/0x8c
[  243.365105] [<ffff8000003cf7e0>] kdbus_name_release_unlocked.isra.5+0x34/0x170
[  243.365183] [<ffff8000003d0554>] kdbus_cmd_name_release+0x1b8/0x1c8
[  243.365270] [<ffff8000003cbd28>] kdbus_handle_ioctl+0x5e0/0x690
[  243.365347] [<ffff8000001b3520>] do_vfs_ioctl+0x31c/0x5c0
[  243.365423] [<ffff8000001b3844>] SyS_ioctl+0x80/0x98
[  243.365473] ---[ end trace 5bf3630c98408d38 ]---

Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: avoid the use of struct timespec
Arnd Bergmann [Fri, 10 Apr 2015 11:43:37 +0000 (13:43 +0200)]
kdbus: avoid the use of struct timespec

I did a routine check for new users of 'timespec', which we are trying to remove
from the kernel in order to survive y2038. kdbus came up and looks particularly
trivial to clean up.

This changes the three ktime_get_ts() variants used in kdbus to ktime_get_ns(),
which aside from removing timespec also simplifies the code and makes it
slightly more efficient by avoiding a two-way conversion.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoDocumentation: kdbus: Fix typos
Sergei Zviagintsev [Thu, 9 Apr 2015 10:08:04 +0000 (13:08 +0300)]
Documentation: kdbus: Fix typos

Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoDocumentation: kdbus: Fix description of KDBUS_SEND_SYNC_REPLY flag
Sergei Zviagintsev [Thu, 9 Apr 2015 10:08:05 +0000 (13:08 +0300)]
Documentation: kdbus: Fix description of KDBUS_SEND_SYNC_REPLY flag

Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoDocumentation: kdbus: Update list of ioctls which cause writing to receiver's pool
Sergei Zviagintsev [Thu, 9 Apr 2015 10:08:06 +0000 (13:08 +0300)]
Documentation: kdbus: Update list of ioctls which cause writing to receiver's pool

Add KDBUS_CMD_BUS_CREATOR_INFO.

Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoDocumentation: kdbus: Fix list of KDBUS_CMD_ENDPOINT_UPDATE errors
Sergei Zviagintsev [Thu, 9 Apr 2015 10:08:07 +0000 (13:08 +0300)]
Documentation: kdbus: Fix list of KDBUS_CMD_ENDPOINT_UPDATE errors

Remove EEXIST.

Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: uapi: Fix kernel-doc for enum kdbus_send_flags
Sergei Zviagintsev [Thu, 9 Apr 2015 10:11:01 +0000 (13:11 +0300)]
kdbus: uapi: Fix kernel-doc for enum kdbus_send_flags

Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
Acked-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoselftest/kdbus: enable cross compilation
Tyler Baker [Wed, 1 Apr 2015 23:20:16 +0000 (16:20 -0700)]
selftest/kdbus: enable cross compilation

Use the CC variable instead of hard coding gcc and include lib.mk.

Signed-off-by: Tyler Baker <tyler.baker@linaro.org>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agosamples: kdbus: build kdbus-workers conditionally
Daniel Mack [Tue, 31 Mar 2015 13:11:34 +0000 (15:11 +0200)]
samples: kdbus: build kdbus-workers conditionally

Give the kdbus sample its own config switch and only build it if it's
explicitly switched on.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: Fix CONFIG_KDBUS help text
Daniel Mack [Tue, 24 Mar 2015 18:51:55 +0000 (19:51 +0100)]
kdbus: Fix CONFIG_KDBUS help text

Drop a left-over from the times when documentation lived in a
simple text file, which is no longer the case. Mention the
auto-generated man-pages and HTML files instead.

Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: connection: fix handling of failed fget()
Daniel Mack [Tue, 17 Mar 2015 18:48:24 +0000 (19:48 +0100)]
kdbus: connection: fix handling of failed fget()

The patch 5fc8dd5c84fc: "kdbus: add connection, queue handling and
message validation code" from Sep 11, 2014, leads to the following
static checker warning:

ipc/kdbus/connection.c:2000 kdbus_cmd_send()
warn: 'cancel_fd' isn't an ERR_PTR

Fix this by checking for NULL pointers returned from fget().

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: fix header guard name
Lucas De Marchi [Tue, 17 Mar 2015 12:21:42 +0000 (09:21 -0300)]
kdbus: fix header guard name

UAPI headers have a _UAPI_ as prefix, which is removed during
headers_install. If it's put as a suffix it will not be removed and will
be the only header with UAPI in the header guard macro.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoDocumentation/kdbus: replace 'reply_cookie' with 'cookie_reply'
Lukasz Skalski [Mon, 16 Mar 2015 09:35:08 +0000 (10:35 +0100)]
Documentation/kdbus: replace 'reply_cookie' with 'cookie_reply'

The member field is called 'cookie_reply', fix the documentation which
incorrectly used 'reply_cookie'.

Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoDocumentation/kdbus: support quiet builds
David Herrmann [Mon, 16 Mar 2015 09:17:12 +0000 (10:17 +0100)]
Documentation/kdbus: support quiet builds

Add support for quiet builds, just like Documentation/DocBook/Makefile
supports.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoDocumentation/kdbus: fix out-of-tree builds
David Herrmann [Mon, 16 Mar 2015 09:17:11 +0000 (10:17 +0100)]
Documentation/kdbus: fix out-of-tree builds

Don't use $(obj) to access source files, but use $(srctree)/$(src)/
instead. This fixes build issues if you use O= with a directory other than
the source directory.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agosamples/kdbus: drop wrong include
David Herrmann [Mon, 16 Mar 2015 09:17:10 +0000 (10:17 +0100)]
samples/kdbus: drop wrong include

There is no reason to use ./include/uapi/ directly from samples. If your
system headers are not up-to-date, you _need_ to run "make
headers-install" (which will install them to ./usr/ in your kernel tree)
before building the examples. Otherwise, you will get warnings and build
failures.

Once ./usr/ is updated with the correct headers, it contains everything we
need, so drop -Iinclude/uapi from the kdbus-workers CFLAGS.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: fix minor typo in the walk-through example
Nicolas Iooss [Sun, 15 Mar 2015 05:13:08 +0000 (13:13 +0800)]
kdbus: fix minor typo in the walk-through example

s/receveiver/receiver/

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: samples/kdbus: add -lrt
David Herrmann [Thu, 12 Mar 2015 16:27:31 +0000 (17:27 +0100)]
kdbus: samples/kdbus: add -lrt

On older systems -lrt is needed for clock_gettime(). Add it to
HOSTLOADLIBES of kdbus-workers so it builds fine on those systems.

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoDocumentation: kdbus: fix location for generated files
Daniel Mack [Mon, 9 Mar 2015 17:00:46 +0000 (18:00 +0100)]
Documentation: kdbus: fix location for generated files

The generated files should reside in Documentation/kdbus, not in the
top-level of the source tree. Also add a .gitignore file and ignore
everything that was built from the XML files.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add selftests
Daniel Mack [Sat, 13 Sep 2014 21:15:02 +0000 (23:15 +0200)]
kdbus: add selftests

This patch adds an extensive test suite for kdbus that checks the most
important code paths in the driver. The idea is to extend the test
suite over time.

Also, this code can serve as another example for how to use the kernel
API from userspace.

The code in the kdbus test suite makes use of the ioctl wrappers
provided by samples/kdbus/kdbus-api.h.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add walk-through user space example
Daniel Mack [Thu, 26 Feb 2015 20:06:38 +0000 (21:06 +0100)]
kdbus: add walk-through user space example

Provide a walk-through example that explains how to use the low-level
ioctl API that kdbus offers. This example is meant to be useful for
developers who want to gain a in-depth understanding of how the kdbus
API works by reading a well-documented real-world example.

This program computes prime-numbers based on the sieve of Eratosthenes.
The master sets up a shared memory region and spawns workers which clear
out the non-primes. The master reacts to keyboard input and to
client-requests to control what each worker does. Note that this is in
no way meant as efficient way to compute primes. It should only serve as
example how a master/worker concept can be implemented with kdbus used
as control messages.

The main process is called the 'master'. It creates a new, private bus
which will be used between the master and its workers to communicate.
The master then spawns a fixed number of workers. Whenever a worker dies
(detected via SIGCHLD), the master spawns a new worker. When done, the
master waits for all workers to exit, prints a status report and exits
itself.

The master process does *not* keep track of its workers. Instead, this
example implements a PULL model. That is, the master acquires a
well-known name on the bus which each worker uses to request tasks from
the master. If there are no more tasks, the master will return an empty
task-list, which casues a worker to exit immediately.

As tasks can be computationally expensive, we support cancellation.
Whenever the master process is interrupted, it will drop its well-known
name on the bus. This causes kdbus to broadcast a name-change
notification. The workers check for broadcast messages regularly and
will exit if they receive one.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add Makefile, Kconfig and MAINTAINERS entry
Daniel Mack [Thu, 11 Sep 2014 16:48:06 +0000 (18:48 +0200)]
kdbus: add Makefile, Kconfig and MAINTAINERS entry

This patch hooks up the build system to actually compile the files
added by previous patches. It also adds an entry to MAINTAINERS to
direct people to Greg KH, David Herrmann, Djalal Harouni and me for
questions and patches.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add policy database implementation
Daniel Mack [Thu, 11 Sep 2014 17:00:43 +0000 (19:00 +0200)]
kdbus: add policy database implementation

This patch adds the policy database implementation.

A policy database restricts the possibilities of connections to own,
see and talk to well-known names. It can be associated with a bus
(through a policy holder connection) or a custom endpoint.

By default, buses have an empty policy database that is augmented on
demand when a policy holder connection is instantiated.

Policies are set through KDBUS_CMD_HELLO (when creating a policy
holder connection), KDBUS_CMD_CONN_UPDATE (when updating a policy
holder connection), KDBUS_CMD_EP_MAKE (creating a custom endpoint)
or KDBUS_CMD_EP_UPDATE (updating a custom endpoint). In all cases,
the name and policy access information is stored in items of type
KDBUS_ITEM_NAME and KDBUS_ITEM_POLICY_ACCESS.

See kdbus.policy(7) for more details.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add name registry implementation
Daniel Mack [Thu, 11 Sep 2014 17:00:00 +0000 (19:00 +0200)]
kdbus: add name registry implementation

This patch adds the name registry implementation.

Each bus instantiates a name registry to resolve well-known names
into unique connection IDs for message delivery. The registry will
be queried when a message is sent with kdbus_msg.dst_id set to
KDBUS_DST_ID_NAME, or when a registry dump is requested.

It's important to have this registry implemented in the kernel to
implement lookups and take-overs in a race-free way.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add code for buses, domains and endpoints
Daniel Mack [Thu, 11 Sep 2014 16:59:39 +0000 (18:59 +0200)]
kdbus: add code for buses, domains and endpoints

Add the logic to handle the following entities:

Domain:
  A domain is an unamed object containing a number of buses. A
  domain is automatically created when an instance of kdbusfs
  is mounted, and destroyed when it is unmounted.
  Every domain offers its own 'control' device node to create
  buses. Domains are isolated from each other.

Bus:
  A bus is a named object inside a domain. Clients exchange messages
  over a bus. Multiple buses themselves have no connection to each
  other; messages can only be exchanged on the same bus. The default
  entry point to a bus, where clients establish the connection to, is
  the "bus" device node /sys/fs/kdbus/<bus name>/bus.  Common operating
  system setups create one "system bus" per system, and one "user
  bus" for every logged-in user. Applications or services may create
  their own private named buses.

Endpoint:
  An endpoint provides the device node to talk to a bus. Opening an
  endpoint creates a new connection to the bus to which the endpoint
  belongs. Every bus has a default endpoint called "bus". A bus can
  optionally offer additional endpoints with custom names to provide
  a restricted access to the same bus. Custom endpoints carry
  additional policy which can be used to give sandboxed processes
  only a locked-down, limited, filtered access to the same bus.

See kdbus(7), kdbus.bus(7), kdbus.endpoint(7) and kdbus.fs(7)
for more details.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add code for notifications and matches
Daniel Mack [Thu, 11 Sep 2014 16:59:16 +0000 (18:59 +0200)]
kdbus: add code for notifications and matches

This patch adds code for matches and notifications.

Notifications are broadcast messages generated by the kernel, which
notify subscribes when connections are created or destroyed, when
well-known-names have been claimed, released or changed ownership,
or when reply messages have timed out.

Matches are used to tell the kernel driver which broadcast messages
a connection is interested in. Matches can either be specific on one
of the kernel-generated notification types, or carry a bloom filter
mask to match against a message from userspace. The latter is a way
to pre-filter messages from other connections in order to mitigate
unnecessary wakeups.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add code to gather metadata
Daniel Mack [Thu, 11 Sep 2014 16:58:45 +0000 (18:58 +0200)]
kdbus: add code to gather metadata

A connection chooses which metadata it wants to have attached to each
message it receives with kdbus_cmd_hello.attach_flags. The metadata
will be attached as items to the messages. All metadata refers to
information about the sending task at sending time, unless otherwise
stated. Also, the metadata is copied, not referenced, so even if the
sending task doesn't exist anymore at the time the message is received,
the information is still preserved.

In traditional D-Bus, userspace tasks like polkit or journald make a
live lookup in procfs and sysfs to gain information about a sending
task. This is racy, of course, as in a a connection-less system like
D-Bus, the originating peer can go away immediately after sending the
message. As we're moving D-Bus prmitives into the kernel, we have to
provide the same semantics here, and inform the receiving peer on the
live credentials of the sending peer.

Metadata is collected at the following times.

 * When a bus is created (KDBUS_CMD_MAKE), information about the
   calling task is collected. This data is returned by the kernel
   via the KDBUS_CMD_BUS_CREATOR_INFO call.

 * When a connection is created (KDBUS_CMD_HELLO), information about
   the calling task is collected. Alternatively, a privileged
   connection may provide 'faked' information about credentials,
   PIDs and security labels which will be stored instead. This data
   is returned by the kernel as information on a connection
   (KDBUS_CMD_CONN_INFO). Only metadata that a connection allowed to
   be sent (by setting its bit in attach_flags_send) will be exported
   in this way.

 * When a message is sent (KDBUS_CMD_SEND), information about the
   sending task and the sending connection are collected. This
   metadata will be attached to the message when it arrives in the
   receiver's pool. If the connection sending the message installed
   faked credentials (see kdbus.connection(7)), the message will not
   be augmented by any information about the currently sending task.

Which metadata items are actually delivered depends on the following
sets and masks:

 (a) the system-wide kmod creds mask
     (module parameter 'attach_flags_mask')

 (b) the per-connection send creds mask, set by the connecting client

 (c) the per-connection receive creds mask, set by the connecting client

 (d) the per-bus minimal creds mask, set by the bus creator

 (e) the per-bus owner creds mask, set by the bus creator

 (f) the mask specified when querying creds of a bus peer

 (g) the mask specified when querying creds of a bus owner

With the following rules:

 [1] The creds attached to messages are determined as a & b & c.

 [2] When connecting to a bus (KDBUS_CMD_HELLO), and ~b & d != 0,
     the call will fail with, -1, and errno is set to ECONNREFUSED.

 [3] When querying creds of a bus peer, the creds returned
     are a & b & f.

 [4] When querying creds of a bus owner, the creds returned
     are a & e & g.

See kdbus.metadata(7) and kdbus.item(7) for more details on which
metadata can currently be attached to messages.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add node and filesystem implementation
Daniel Mack [Fri, 14 Nov 2014 08:59:08 +0000 (09:59 +0100)]
kdbus: add node and filesystem implementation

kdbusfs is a filesystem that will expose a fresh kdbus domain context
each time it is mounted. Per mount point, there will be a 'control'
node, which can be used to create buses. fs.c contains the
implementation of that pseudo-fs. Exported inodes of 'file' type have
their i_fop set to either kdbus_handle_control_ops or
kdbus_handle_ep_ops, depending on their type. The actual dispatching
of file operations is done from handle.c

node.c is an implementation of a kdbus object that has an id and
children, organized in an R/B tree. The tree is used by the filesystem
code for lookup and iterator functions, and to deactivate children
once the parent is deactivated. Every inode exported by kdbusfs is
backed by a kdbus_node, hence it is embedded in struct kdbus_ep,
struct kdbus_bus and struct kdbus_domain.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add connection, queue handling and message validation code
Daniel Mack [Thu, 11 Sep 2014 16:57:24 +0000 (18:57 +0200)]
kdbus: add connection, queue handling and message validation code

This patch adds code to create and destroy connections, to validate
incoming messages and to maintain the queue of messages that are
associated with a connection.

Note that connection and queue have a 1:1 relation, the code is only
split in two parts for cleaner separation and better readability.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add connection pool implementation
Daniel Mack [Thu, 11 Sep 2014 16:56:41 +0000 (18:56 +0200)]
kdbus: add connection pool implementation

A pool for data received from the kernel is installed for every
connection of the bus, and it is used to copy data from the kernel to
userspace clients, for messages and other information.

It is accessed when one of the following ioctls is issued:

  * KDBUS_CMD_MSG_RECV, to receive a message
  * KDBUS_CMD_NAME_LIST, to dump the name registry
  * KDBUS_CMD_CONN_INFO, to retrieve information on a connection

The offsets returned by either one of the aforementioned ioctls
describe offsets inside the pool. Internally, the pool is organized in
slices, that are dynamically allocated on demand. The overall size of
the pool is chosen by the connection when it connects to the bus with
KDBUS_CMD_HELLO.

In order to make the slice available for subsequent calls,
KDBUS_CMD_FREE has to be called on the offset.

To access the memory, the caller is expected to mmap() it to its task.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add driver skeleton, ioctl entry points and utility functions
Daniel Mack [Thu, 11 Sep 2014 16:52:52 +0000 (18:52 +0200)]
kdbus: add driver skeleton, ioctl entry points and utility functions

Add the basic driver structure.

handle.c is the main ioctl command dispatcher that calls into other parts
of the driver.

main.c contains the code that creates the initial domain at startup, and
util.c has utility functions such as item iterators that are shared with
other files.

limits.h describes limits on things like maximum data structure sizes,
number of messages per users and suchlike. Some of the numbers currently
picked are rough ideas of what what might be sufficient and are probably
rather conservative.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add uapi header file
Daniel Mack [Thu, 11 Sep 2014 16:38:06 +0000 (18:38 +0200)]
kdbus: add uapi header file

This patch adds the header file which describes the low-level
transport protocol used by various ioctls. The header file is located
in include/uapi/linux/ as it is shared between kernel and userspace,
and it only contains data structure definitions, enums and defines
for constants.

The low-level kernel API of kdbus is exposed through ioctls, employed
on nodes exposed by kdbusfs. We've chosen a ioctl-based implementation
over syscalls for various reaons:

 * The ioctls kdbus offers are completely specific to nodes exposed by
   kdbusfs and can not be applied to any other file descriptor in a
   system.

 * The file descriptors derived from opening nodes in kdbusfs can only be
   used for poll(), close() and the ioctls described in kdbus.h.

 * Not all systems will make use of kdbus eventually, and we want to
   make as many parts of the kernel optional at build time.

 * We want to build the kdbus code as module, which is impossible to
   do when implemented with syscalls.

 * The ioctl dispatching logic does not show up in our performance
   graphs; its overhead is negligible.

 * For development, being able to build, load and unload a separate
   module with a versioned name suffix is essential.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: add documentation
Daniel Mack [Thu, 11 Sep 2014 19:50:47 +0000 (21:50 +0200)]
kdbus: add documentation

kdbus is a system for low-latency, low-overhead, easy to use
interprocess communication (IPC).

The interface to all functions in this driver is implemented via ioctls
on files exposed through a filesystem called 'kdbusfs'. The default
mount point of kdbusfs is /sys/fs/kdbus. This patch adds detailed
documentation about the kernel level API design.

This patch adds a set of comprehensive set of DocBook files which
can be turned into man-pages using 'make mandocs', or into HTML
files with 'make htmldocs'.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agoSmack: limited capability for changing process label
Zbigniew Jasinski [Mon, 19 Oct 2015 16:23:53 +0000 (18:23 +0200)]
Smack: limited capability for changing process label

This feature introduces new kernel interface:

- <smack_fs>/relabel-self - for setting transition labels list

This list is used to control smack label transition mechanism.
List is set by, and per process. Process can transit to new label only if
label is on the list. Only process with CAP_MAC_ADMIN capability can add
labels to this list. With this list, process can change it's label without
CAP_MAC_ADMIN but only once. After label changing, list is unset.

Changes in v2:
* use list_for_each_entry instead of _rcu during label write
* added missing description in security/Smack.txt

Changes in v3:
* squashed into one commit

Changes in v4:
* switch from global list to per-task list
* since the per-task list is accessed only by the task itself
  there is no need to use synchronization mechanisms on it

Changes in v5:
* change smackfs interface of relabel-self to the one used for onlycap
  multiple labels are accepted, separated by space, which
  replace the previous list upon write

Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoSmack: pipefs fix in smack_d_instantiate
Roman Kubiak [Mon, 5 Oct 2015 10:27:16 +0000 (12:27 +0200)]
Smack: pipefs fix in smack_d_instantiate

This fix writes the task label when
smack_d_instantiate is called, before the
label of the superblock was written on the
pipe's inode.

Signed-off-by: Roman Kubiak <r.kubiak@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoSmack - Fix build error with bringup unconfigured
Casey Schaufler [Wed, 12 Aug 2015 18:56:02 +0000 (11:56 -0700)]
Smack - Fix build error with bringup unconfigured

The changes for mounting binary filesystems was allied
improperly, with the list of tokens being in an ifdef that
it shouldn't have been. Fix that, and a couple style issues
that were bothering me.

Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoKernel threads excluded from smack checks
Roman Kubiak [Mon, 10 Aug 2015 14:54:25 +0000 (16:54 +0200)]
Kernel threads excluded from smack checks

Adds an ignore case for kernel tasks,
so that they can access all resources.

Since kernel worker threads are spawned with
floor label, they are severely restricted by
Smack policy. It is not an issue without onlycap,
as these processes also run with root,
so CAP_MAC_OVERRIDE kicks in. But with onlycap
turned on, there is no way to change the label
for these processes.

Signed-off-by: Roman Kubiak <r.kubiak@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agosmack: allow mount opts setting over filesystems with binary mount data
Vivek Trivedi [Mon, 22 Jun 2015 10:06:06 +0000 (15:36 +0530)]
smack: allow mount opts setting over filesystems with binary mount data

Add support for setting smack mount labels(using smackfsdef, smackfsroot,
smackfshat, smackfsfloor, smackfstransmute) for filesystems with binary
mount data like NFS.

To achieve this, implement sb_parse_opts_str and sb_set_mnt_opts security
operations in smack LSM similar to SELinux.

Signed-off-by: Vivek Trivedi <t.vivek@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
7 years agoSmack: allow multiple labels in onlycap
Rafal Krypa [Tue, 2 Jun 2015 09:23:48 +0000 (11:23 +0200)]
Smack: allow multiple labels in onlycap

Smack onlycap allows limiting of CAP_MAC_ADMIN and CAP_MAC_OVERRIDE to
processes running with the configured label. But having single privileged
label is not enough in some real use cases. On a complex system like Tizen,
there maybe few programs that need to configure Smack policy in run-time
and running them all with a single label is not always practical.
This patch extends onlycap feature for multiple labels. They are configured
in the same smackfs "onlycap" interface, separated by spaces.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
7 years agoSmack: fix seq operations in smackfs
Rafal Krypa [Thu, 21 May 2015 16:24:31 +0000 (18:24 +0200)]
Smack: fix seq operations in smackfs

Use proper RCU functions and read locking in smackfs seq_operations.

Smack gets away with not using proper RCU functions in smackfs, because
it never removes entries from these lists. But now one list will be
needed (with interface in smackfs) that will have both elements added and
removed to it.
This change will also help any future changes implementing removal of
unneeded entries from other Smack lists.

The patch also fixes handling of pos argument in smk_seq_start and
smk_seq_next. This fixes a bug in case when smackfs is read with a small
buffer:

Kernel panic - not syncing: Kernel mode fault at addr 0xfa0000011b
CPU: 0 PID: 1292 Comm: dd Not tainted 4.1.0-rc1-00012-g98179b8 #13
Stack:
 00000003 0000000d 7ff39e48 7f69fd00
 7ff39ce0 601ae4b0 7ff39d50 600e587b
 00000010 6039f690 7f69fd40 00612003
Call Trace:
 [<601ae4b0>] load2_seq_show+0x19/0x1d
 [<600e587b>] seq_read+0x168/0x331
 [<600c5943>] __vfs_read+0x21/0x101
 [<601a595e>] ? security_file_permission+0xf8/0x105
 [<600c5ec6>] ? rw_verify_area+0x86/0xe2
 [<600c5fc3>] vfs_read+0xa1/0x14c
 [<600c68e2>] SyS_read+0x57/0xa0
 [<6001da60>] handle_syscall+0x60/0x80
 [<6003087d>] userspace+0x442/0x548
 [<6001aa77>] ? interrupt_end+0x0/0x80
 [<6001daae>] ? copy_chunk_to_user+0x0/0x2b
 [<6002cb6b>] ? save_registers+0x1f/0x39
 [<60032ef7>] ? arch_prctl+0xf5/0x170
 [<6001a92d>] fork_handler+0x85/0x87

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
7 years agosmack: pass error code through pointers
Lukasz Pawelczyk [Mon, 20 Apr 2015 15:12:54 +0000 (17:12 +0200)]
smack: pass error code through pointers

This patch makes the following functions to use ERR_PTR() and related
macros to pass the appropriate error code through returned pointers:

smk_parse_smack()
smk_import_entry()
smk_fetch()

It also makes all the other functions that use them to handle the
error cases properly. This ways correct error codes from places
where they happened can be propagated to the user space if necessary.

Doing this it fixes a bug in onlycap and unconfined files
handling. Previously their content was cleared on any error from
smk_import_entry/smk_parse_smack, be it EINVAL (as originally intended)
or ENOMEM. Right now it only reacts on EINVAL passing other codes
properly to userspace.

Comments have been updated accordingly.

Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
7 years agomedia: s5p-mfc: set src_bufs_cnt with requested buffer for DMABUF and USERPTR
Seung-Woo Kim [Sat, 31 Oct 2015 08:24:54 +0000 (17:24 +0900)]
media: s5p-mfc: set src_bufs_cnt with requested buffer for DMABUF and USERPTR

During start_streaming of output, it checks src_bufs_cnt compared
with pb_count. But it is only meaningful for MMAP memory. So this
patch fixes to set src_bufs_cnt with requested buffer for non MMAP
memory.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoLOCAL / net: bcm4358: call vfs functions instead of direct file ops
Przemyslaw Marczak [Mon, 2 Nov 2015 14:16:27 +0000 (15:16 +0100)]
LOCAL / net: bcm4358: call vfs functions instead of direct file ops

After enable writing the card's MAC address to filesystem by:

commit: LOCAL / net: bcm4358: Enable the some configurations

in the driver's code for bcmdhd4358, filesystem access is required
to read/write some settings, especially the card's MAC address.

Instead of calling proper fs functions, a direct calls were used
to particular file operations methods.
Since read/write operations are deprecated, the present code without
null pointer checking, refers to null function pointers.
This causes kernel panic when runs wpa_supplicant application.

This commit moves the direct calls to proper function calls,
which fixes the panic issue.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
7 years agoLOCAL / arm64: defconfig: enable governers for devfreq
Joonyoung Shim [Mon, 2 Nov 2015 09:50:00 +0000 (18:50 +0900)]
LOCAL / arm64: defconfig: enable governers for devfreq

Enable powersave and userspace governers for devfreq.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agoRevert "devfreq: Remove mutex deadlock caused by modification of update_devfreq()"
Joonyoung Shim [Mon, 2 Nov 2015 09:44:25 +0000 (18:44 +0900)]
Revert "devfreq: Remove mutex deadlock caused by modification of update_devfreq()"

This reverts commit 0d046ecc157975c44a1c837eae5dd7c420160968.

Refer commit 2bf9b157448b ("LOCAL / PM / devfreq: rollback mutex locking
for update_devfreq()"). Already it was used in exynos-next-4.0.4 branch.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agoLOCAL / PM / devfreq: rollback mutex locking for update_devfreq()
Joonyoung Shim [Mon, 7 Sep 2015 07:42:31 +0000 (16:42 +0900)]
LOCAL / PM / devfreq: rollback mutex locking for update_devfreq()

Userspace, performance and powersave governers call update_devfreq()
with mutex locking. It causes nested mutex locking error.

I'm not sure that i should make a choice which reverting change that
includes mutex locking in update_devfreq() or removing mutex locking
before update_devfreq() is called on each governers.

IMHO, the upstream codes don't include mutex locking in update_devfreq()
so first option is better.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agoinput: touchscreen: Add sysfs node for control power
Beomho Seo [Mon, 14 Sep 2015 11:57:56 +0000 (20:57 +0900)]
input: touchscreen: Add sysfs node for control power

This patch add sysfs node for control power.
User layer can control to use this node.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
7 years agodrm/exynos: fix waiting pageflip on i80 panel
Joonyoung Shim [Fri, 23 Oct 2015 02:43:44 +0000 (11:43 +0900)]
drm/exynos: fix waiting pageflip on i80 panel

If panel is use i80 interface, encoder should wait to complete prior
pageflip before encoder disables panel because te interrupt is happened
by panel.

Upstream Exynos DRM driver doesn't need this because Exynos atomic
commit procedures already does this job of waiting for pending updates
to finish. Refer the commit c4533665d819 ("drm/exynos: wait all planes
updates to finish") applied from v4.3-rc1

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[fix build issue because of removed pending_flip]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>