A bug was introduced by commit 20932f1f83d3 ("fec_ecat: add fec native
driver for raw packet proto"). When both fd and fast_raw_socket_fd are
-1, the fast_raw_socket_dev would be null, then it will perform a null
pointer operation and causes the following oops. The fast_raw_socket_dev
is only set to a valid value when fast_raw_socket_fd is not -1. So add a
check for fast_raw_socket_fd before invoking
fast_raw_socket_dev->netdev_ops->ndo_fast_recv().

Unable to handle kernel NULL pointer dereference at virtual address 
00000000000000d8
Mem abort info:
  ESR = 0x0000000096000005
  EC = 0x25: DABT (current EL), IL = 32 bits
Mem abort info:
  ESR = 0x0000000096000005
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x05: level 1 translation fault
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x05: level 1 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000005
Data abort info:
  ISV = 0, ISS = 0x00000005
  CM = 0, WnR = 0
  CM = 0, WnR = 0
user pgtable: 4k pages, 39-bit VAs, pgdp=000000008aa50000
user pgtable: 4k pages, 39-bit VAs, pgdp=0000000084314000
[00000000000000d8] pgd=0000000000000000, p4d=0000000000000000, 
pud=0000000000000000
[00000000000000d8] pgd=0000000000000000, p4d=0000000000000000, 
pud=0000000000000000
Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP

Fixes: 20932f1f83d3("fec_ecat: add fec native driver for raw packet proto")
Signed-off-by: Xiaolei Wang <xiaolei.w...@windriver.com>
---
 net/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/socket.c b/net/socket.c
index 4fc1e256d0f3..94ff9a5430aa 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2209,7 +2209,7 @@ int __sys_recvfrom(int fd, void __user *ubuf, size_t 
size, unsigned int flags,
        int err, err2;
        int fput_needed;
 
-       if (fd == fast_raw_socket_fd) {
+       if (fd == fast_raw_socket_fd && fast_raw_socket_fd != -1) {
                err = 
fast_raw_socket_dev->netdev_ops->ndo_fast_recv(fast_raw_socket_dev, ubuf, size, 
addr, addr_len);
                return err;
        }
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13946): 
https://lists.yoctoproject.org/g/linux-yocto/message/13946
Mute This Topic: https://lists.yoctoproject.org/mt/106199626/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to