mbox series

[0/2] prevent potential access of uninitialized members in can_rcv() and canfd_rcv()

Message ID 20201103213906.24219-1-anant.thazhemadam@gmail.com
Headers show
Series prevent potential access of uninitialized members in can_rcv() and canfd_rcv() | expand

Message

Anant Thazhemadam Nov. 3, 2020, 9:39 p.m. UTC
In both can_rcv(), and canfd_rcv(), when skb->len = 0, cfd->len 
(which is uninitialized) is accessed by pr_warn_once().

Performing the validation check for cfd->len separately, after the 
validation check for skb->len is done, resolves this issue in both 
instances, without compromising the degree of detail provided in the
log messages.

Anant Thazhemadam (2):
  can: af_can: prevent potential access of uninitialized member in
    can_rcv()
  can: af_can: prevent potential access of uninitialized member in
    canfd_rcv()

 net/can/af_can.c | 38 ++++++++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 10 deletions(-)

Comments

Marc Kleine-Budde Nov. 3, 2020, 10:17 p.m. UTC | #1
On 11/3/20 10:39 PM, Anant Thazhemadam wrote:
> In both can_rcv(), and canfd_rcv(), when skb->len = 0, cfd->len 
> (which is uninitialized) is accessed by pr_warn_once().
> 
> Performing the validation check for cfd->len separately, after the 
> validation check for skb->len is done, resolves this issue in both 
> instances, without compromising the degree of detail provided in the
> log messages.
> 
> Anant Thazhemadam (2):
>   can: af_can: prevent potential access of uninitialized member in
>     can_rcv()
>   can: af_can: prevent potential access of uninitialized member in
>     canfd_rcv()
> 
>  net/can/af_can.c | 38 ++++++++++++++++++++++++++++----------
>  1 file changed, 28 insertions(+), 10 deletions(-)
> 

Applied both to linux-can/testing

Tnx,
Marc