]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: mc: Fix flags handling when creating pad links
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 14 Jan 2024 22:24:12 +0000 (00:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:08 +0000 (15:11 +0200)
commit61e39ad6b246d0e015c0403c3320e1752379dd60
tree85cda29aa867080d1aae68af48a6938379a9ffba
parent326ae52cc95a31d68f2f6d89212226586f6462bf
media: mc: Fix flags handling when creating pad links

[ Upstream commit 422f7af75d03d50895938d38bc9cb8be759c440f ]

The media_create_pad_link() function doesn't correctly clear reject link
type flags, nor does it set the DATA_LINK flag. It only works because
the MEDIA_LNK_FL_DATA_LINK flag's value is 0.

Fix it by returning an error if any link type flag is set. This doesn't
introduce any regression, as nobody calls the media_create_pad_link()
function with link type flags (easily checked by grepping for the flag
in the source code, there are very few hits).

Set the MEDIA_LNK_FL_DATA_LINK explicitly, which is a no-op that the
compiler will optimize out, but is still useful to make the code more
explicit and easier to understand.

Cc: stable@vger.kernel.org # 6.1
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/mc/mc-entity.c