Commit c7756f3a authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull media fixes from Mauro Carvalho Chehab:

 - fix VIDIOC_DQEVENT ioctl handling for 32-bit userspace with a 64-bit
   kernel

 - regression fix for videobuf2 core

 - fix for CEC core when handling non-block transmit

 - hi846: fix a clang warning

* tag 'media/v5.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: hi846: remove the of_match_ptr macro
  media: hi846: include property.h instead of of_graph.h
  media: cec: copy sequence field for the reply
  media: videobuf2-dma-sg: Fix buf->vb NULL pointer dereference
  media: v4l2-core: fix VIDIOC_DQEVENT handling on non-x86
parents 13e4ad2c 62456590
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1199,6 +1199,7 @@ void cec_received_msg_ts(struct cec_adapter *adap,
			if (abort)
				dst->rx_status |= CEC_RX_STATUS_FEATURE_ABORT;
			msg->flags = dst->flags;
			msg->sequence = dst->sequence;
			/* Remove it from the wait_queue */
			list_del_init(&data->list);

+2 −0
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@ static void *vb2_dma_sg_get_userptr(struct vb2_buffer *vb, struct device *dev,
	buf->offset = vaddr & ~PAGE_MASK;
	buf->size = size;
	buf->dma_sgt = &buf->sg_table;
	buf->vb = vb;
	vec = vb2_create_framevec(vaddr, size);
	if (IS_ERR(vec))
		goto userptr_fail_pfnvec;
@@ -642,6 +643,7 @@ static void *vb2_dma_sg_attach_dmabuf(struct vb2_buffer *vb, struct device *dev,
	buf->dma_dir = vb->vb2_queue->dma_dir;
	buf->size = size;
	buf->db_attach = dba;
	buf->vb = vb;

	return buf;
}
+2 −2
Original line number Diff line number Diff line
@@ -7,9 +7,9 @@
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/pm_runtime.h>
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
@@ -2176,7 +2176,7 @@ static struct i2c_driver hi846_i2c_driver = {
	.driver = {
		.name = "hi846",
		.pm = &hi846_pm_ops,
		.of_match_table = of_match_ptr(hi846_of_match),
		.of_match_table = hi846_of_match,
	},
	.probe_new = hi846_probe,
	.remove = hi846_remove,
+17 −24
Original line number Diff line number Diff line
@@ -751,10 +751,6 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *p64,
/*
 * x86 is the only compat architecture with different struct alignment
 * between 32-bit and 64-bit tasks.
 *
 * On all other architectures, v4l2_event32 and v4l2_event32_time32 are
 * the same as v4l2_event and v4l2_event_time32, so we can use the native
 * handlers, converting v4l2_event to v4l2_event_time32 if necessary.
 */
struct v4l2_event32 {
	__u32				type;
@@ -772,21 +768,6 @@ struct v4l2_event32 {
	__u32				reserved[8];
};

#ifdef CONFIG_COMPAT_32BIT_TIME
struct v4l2_event32_time32 {
	__u32				type;
	union {
		compat_s64		value64;
		__u8			data[64];
	} u;
	__u32				pending;
	__u32				sequence;
	struct old_timespec32		timestamp;
	__u32				id;
	__u32				reserved[8];
};
#endif

static int put_v4l2_event32(struct v4l2_event *p64,
			    struct v4l2_event32 __user *p32)
{
@@ -802,7 +783,22 @@ static int put_v4l2_event32(struct v4l2_event *p64,
	return 0;
}

#endif

#ifdef CONFIG_COMPAT_32BIT_TIME
struct v4l2_event32_time32 {
	__u32				type;
	union {
		compat_s64		value64;
		__u8			data[64];
	} u;
	__u32				pending;
	__u32				sequence;
	struct old_timespec32		timestamp;
	__u32				id;
	__u32				reserved[8];
};

static int put_v4l2_event32_time32(struct v4l2_event *p64,
				   struct v4l2_event32_time32 __user *p32)
{
@@ -818,7 +814,6 @@ static int put_v4l2_event32_time32(struct v4l2_event *p64,
	return 0;
}
#endif
#endif

struct v4l2_edid32 {
	__u32 pad;
@@ -880,9 +875,7 @@ static int put_v4l2_edid32(struct v4l2_edid *p64,
#define VIDIOC_QUERYBUF32_TIME32	_IOWR('V',  9, struct v4l2_buffer32_time32)
#define VIDIOC_QBUF32_TIME32		_IOWR('V', 15, struct v4l2_buffer32_time32)
#define VIDIOC_DQBUF32_TIME32		_IOWR('V', 17, struct v4l2_buffer32_time32)
#ifdef CONFIG_X86_64
#define	VIDIOC_DQEVENT32_TIME32		_IOR ('V', 89, struct v4l2_event32_time32)
#endif
#define VIDIOC_PREPARE_BUF32_TIME32	_IOWR('V', 93, struct v4l2_buffer32_time32)
#endif

@@ -936,10 +929,10 @@ unsigned int v4l2_compat_translate_cmd(unsigned int cmd)
#ifdef CONFIG_X86_64
	case VIDIOC_DQEVENT32:
		return VIDIOC_DQEVENT;
#endif
#ifdef CONFIG_COMPAT_32BIT_TIME
	case VIDIOC_DQEVENT32_TIME32:
		return VIDIOC_DQEVENT;
#endif
#endif
	}
	return cmd;
@@ -1032,10 +1025,10 @@ int v4l2_compat_put_user(void __user *arg, void *parg, unsigned int cmd)
#ifdef CONFIG_X86_64
	case VIDIOC_DQEVENT32:
		return put_v4l2_event32(parg, arg);
#endif
#ifdef CONFIG_COMPAT_32BIT_TIME
	case VIDIOC_DQEVENT32_TIME32:
		return put_v4l2_event32_time32(parg, arg);
#endif
#endif
	}
	return 0;