From: Greg KH <greg@kroah.com>
To: Maciej Matraszek <m.matraszek@samsung.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Mauro Carvalho Chehab <m.chehab@samsung.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
stable@vger.kernel.org,
Krzysztof Kozlowski <k.kozlowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH v2] [media] v4l2-common: fix overflow in v4l_bound_align_image()
Date: Wed, 10 Sep 2014 10:10:13 -0700 [thread overview]
Message-ID: <20140910171013.GA14048@kroah.com> (raw)
In-Reply-To: <1410367869-27688-1-git-send-email-m.matraszek@samsung.com>
On Wed, Sep 10, 2014 at 06:51:09PM +0200, Maciej Matraszek wrote:
> Fix clamp_align() used in v4l_bound_align_image() to prevent overflow when
> passed large value like UINT32_MAX. In the current implementation:
> clamp_align(UINT32_MAX, 8, 8192, 3)
> returns 8, because in line:
> x = (x + (1 << (align - 1))) & mask;
> x overflows to (-1 + 4) & 0x7 = 3, while expected value is 8192.
>
> v4l_bound_align_image() is heavily used in VIDIOC_S_FMT
> and VIDIOC_SUBDEV_S_FMT ioctls handlers, and documentation of the latter
> explicitly states that:
>
> "The modified format should be as close as possible to the original request."
> -- http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-subdev-g-fmt.html
>
> Thus one would expect, that passing UINT32_MAX as format width and height
> will result in setting maximum possible resolution for the device.
> Particularly, when the driver doesn't support VIDIOC_ENUM_FRAMESIZES ioctl,
> which is common in the codebase.
>
> Fixes: b0d3159be9a3 ("V4L/DVB (11901): v4l2: Create helper function for bounding and aligning images")
> Signed-off-by: Maciej Matraszek <m.matraszek@samsung.com>
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
> ---
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read Documentation/stable_kernel_rules.txt
for how to do this properly.
</formletter>
next prev parent reply other threads:[~2014-09-10 17:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-10 16:51 [PATCH v2] [media] v4l2-common: fix overflow in v4l_bound_align_image() Maciej Matraszek
2014-09-10 17:10 ` Greg KH [this message]
2014-09-12 16:11 ` Maciej Matraszek
2014-09-12 16:29 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140910171013.GA14048@kroah.com \
--to=greg@kroah.com \
--cc=b.zolnierkie@samsung.com \
--cc=hans.verkuil@cisco.com \
--cc=k.kozlowski@samsung.com \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=m.matraszek@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.