Thread (6 messages) flat view 6 messages, 2 authors, 2021-10-30

Re: [PATCH net-next 4/4] ethtool: don't drop the rtnl_lock half way thru the ioctl

From: kernel test robot <hidden>
Date: 2021-10-30 08:51:34
Also in: oe-kbuild-all

Hi Jakub,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Jakub-Kicinski/improve-ethtool-rtnl-vs-devlink-locking/20211030-120714
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 28131d896d6d316bc1f6f305d1a9ed6d96c3f2a1
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/1ff3b7575e0d00813e134dd4945e5ccab234f2aa
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jakub-Kicinski/improve-ethtool-rtnl-vs-devlink-locking/20211030-120714
        git checkout 1ff3b7575e0d00813e134dd4945e5ccab234f2aa
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>

All errors (new ones prefixed by >>):

   net/ethtool/ioctl.c: In function 'dev_ethtool':
quoted
net/ethtool/ioctl.c:3049:63: error: passing argument 1 of 'devlink_compat_flash_update' from incompatible pointer type [-Werror=incompatible-pointer-types]
    3049 |                         rc = devlink_compat_flash_update(state->devlink,
         |                                                          ~~~~~^~~~~~~~~
         |                                                               |
         |                                                               struct devlink *
   In file included from net/ethtool/ioctl.c:28:
   include/net/devlink.h:1757:48: note: expected 'struct net_device *' but argument is of type 'struct devlink *'
    1757 | devlink_compat_flash_update(struct net_device *dev, const char *file_name)
         |                             ~~~~~~~~~~~~~~~~~~~^~~
quoted
net/ethtool/ioctl.c:3054:61: error: passing argument 1 of 'devlink_compat_running_version' from incompatible pointer type [-Werror=incompatible-pointer-types]
    3054 |                         devlink_compat_running_version(state->devlink,
         |                                                        ~~~~~^~~~~~~~~
         |                                                             |
         |                                                             struct devlink *
   In file included from net/ethtool/ioctl.c:28:
   include/net/devlink.h:1752:51: note: expected 'struct net_device *' but argument is of type 'struct devlink *'
    1752 | devlink_compat_running_version(struct net_device *dev, char *buf, size_t len)
         |                                ~~~~~~~~~~~~~~~~~~~^~~
   cc1: some warnings being treated as errors


vim +/devlink_compat_flash_update +3049 net/ethtool/ioctl.c

  3016	
  3017	int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *useraddr)
  3018	{
  3019		struct ethtool_devlink_compat *state;
  3020		u32 ethcmd;
  3021		int rc;
  3022	
  3023		if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
  3024			return -EFAULT;
  3025	
  3026		state = kzalloc(sizeof(*state), GFP_KERNEL);
  3027		if (!state)
  3028			return -ENOMEM;
  3029	
  3030		switch (ethcmd) {
  3031		case ETHTOOL_FLASHDEV:
  3032			if (copy_from_user(&state->efl, useraddr, sizeof(state->efl))) {
  3033				rc = -EFAULT;
  3034				goto exit_free;
  3035			}
  3036			state->efl.data[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0;
  3037			break;
  3038		}
  3039	
  3040		rtnl_lock();
  3041		rc = __dev_ethtool(net, ifr, useraddr, ethcmd, state);
  3042		rtnl_unlock();
  3043		if (rc)
  3044			goto exit_free;
  3045	
  3046		switch (ethcmd) {
  3047		case ETHTOOL_FLASHDEV:
  3048			if (state->devlink)
3049				rc = devlink_compat_flash_update(state->devlink,
  3050								 state->efl.data);
  3051			break;
  3052		case ETHTOOL_GDRVINFO:
  3053			if (state->devlink)
3054				devlink_compat_running_version(state->devlink,
  3055							       state->info.fw_version,
  3056							       sizeof(state->info.fw_version));
  3057			if (copy_to_user(useraddr, &state->info, sizeof(state->info))) {
  3058				rc = -EFAULT;
  3059				goto exit_free;
  3060			}
  3061			break;
  3062		}
  3063	
  3064	exit_free:
  3065		if (state->devlink)
  3066			devlink_put(state->devlink);
  3067		kfree(state);
  3068		return rc;
  3069	}
  3070	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help