lkml.org 
[lkml]   [2019]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 1/1] r8152: sync sa_family with the media type of network device
Date
> -----Original Message-----
> From: crag0715@gmail.com <crag0715@gmail.com>
> Sent: Monday, April 22, 2019 12:04 AM
> To: linux-usb@vger.kernel.org; netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; hayeswang@realtek.com; Limonciello, Mario;
> crag0715@gmail.com; Wang, Crag; David S. Miller; Simon Glass; Grant Grundler;
> Sean Paul; Chen7, David; Kai-Heng Feng; Gustavo A. R. Silva; Charles Hyde;
> Sebastian Andrzej Siewior; zhong jiang
> Subject: [PATCH v2 1/1] r8152: sync sa_family with the media type of network
> device
>
>
> [EXTERNAL EMAIL]
>
> From: "Crag.Wang" <crag.wang@dell.com>
>
> Without this patch the socket address family sporadically gets wrong
> value ends up the dev_set_mac_address() fails to set the desired MAC
> address.

Ah yes, this is because of an uninitialized struct sockaddr, so random garbage.
I didn't catch it during my testing, good catch.

>
> Signed-off-by: Crag.Wang <crag.wang@dell.com>
> ---
> drivers/net/usb/r8152.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 4c63b40d5e00..41fb39ce69c9 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -1225,6 +1225,8 @@ static int determine_ethernet_addr(struct r8152 *tp,
> struct sockaddr *sa)
> struct net_device *dev = tp->netdev;
> int ret;
>
> + sa->sa_family = dev->type;
> +
> if (tp->version == RTL_VER_01) {
> ret = pla_ocp_read(tp, PLA_IDR, 8, sa->sa_data);
> } else {
> --
> 2.20.1

Reviewed-By: Mario Limonciello <mario.limonciello@dell.com>

\
 
 \ /
  Last update: 2019-04-23 04:03    [W:0.064 / U:9.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site