Skip to content

Commit 233900d

Browse files
committed
Merge tag 'linux-can-fixes-for-4.9-20161207' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== pull-request: can 2016-12-07 Andrey Konovalov triggered a warning in the CAN RAW layer, which is fixed by a patch by me. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents bc3913a + 332b05c commit 233900d

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

include/uapi/linux/can.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,6 @@ struct can_filter {
196196
};
197197

198198
#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */
199+
#define CAN_RAW_FILTER_MAX 512 /* maximum number of can_filter set via setsockopt() */
199200

200201
#endif /* !_UAPI_CAN_H */

net/can/raw.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,9 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
499499
if (optlen % sizeof(struct can_filter) != 0)
500500
return -EINVAL;
501501

502+
if (optlen > CAN_RAW_FILTER_MAX * sizeof(struct can_filter))
503+
return -EINVAL;
504+
502505
count = optlen / sizeof(struct can_filter);
503506

504507
if (count > 1) {

0 commit comments

Comments
 (0)