@@ -979,6 +979,19 @@ static ssize_t store_protocols(struct device *device,
goto out;
}
+ if (fattr->type == RC_FILTER_WAKEUP) {
+ /* A proto_names entry must cover enabled wakeup protocols */
+ for (i = 0; i < ARRAY_SIZE(proto_names); i++)
+ if (type & proto_names[i].type &&
+ !(type & ~proto_names[i].type))
+ break;
+ if (i == ARRAY_SIZE(proto_names)) {
+ IR_dprintk(1, "Multiple distinct wakeup protocols\n");
+ ret = -EINVAL;
+ goto out;
+ }
+ }
+
change_protocol = (fattr->type == RC_FILTER_NORMAL)
? dev->change_protocol : dev->change_wakeup_protocol;
if (change_protocol) {
Limit the enabled wakeup protocols to be within a protocol group, as defined by the proto_names array. For example this prevents the selection of both rc-5 and nec, while allowing rc-5 alone (which encompasses both normal rc-5 and rc-5x). It doesn't usually make sense to enable more than one wakeup protocol since only a single protocol can usually be used for wakeup at a time, and doing so with encode based wakeup will result in an arbitrary protocol being used if multiple are possible. Reported-by: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com> Cc: Antti Seppälä <a.seppala@gmail.com> --- Sorry it took a little while to get around to submitting this. --- drivers/media/rc/rc-main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)