[Linux-kernel-mentees] [PATCH] net: tipc: fix general protection fault in tipc_conn_delete_sub

kernel test robot lkp at intel.com
Mon Jul 27 15:52:50 UTC 2020


Hi K,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.8-rc7 next-20200724]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/B-K-Karthik/net-tipc-fix-general-protection-fault-in-tipc_conn_delete_sub/20200727-211330
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 92ed301919932f777713b9172e525674157e983d
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   net/tipc/topsrv.c: In function 'tipc_conn_send_to_sock':
>> net/tipc/topsrv.c:259:10: warning: 'return' with a value, in function returning void [-Wreturn-type]
     259 |   return -EINVAL;
         |          ^
   net/tipc/topsrv.c:247:13: note: declared here
     247 | static void tipc_conn_send_to_sock(struct tipc_conn *con)
         |             ^~~~~~~~~~~~~~~~~~~~~~

vim +/return +259 net/tipc/topsrv.c

   246	
   247	static void tipc_conn_send_to_sock(struct tipc_conn *con)
   248	{
   249		struct list_head *queue = &con->outqueue;
   250		struct tipc_topsrv *srv = con->server;
   251		struct outqueue_entry *e;
   252		struct tipc_event *evt;
   253		struct msghdr msg;
   254		struct kvec iov;
   255		int count = 0;
   256		int ret;
   257	
   258		if (!con->server)
 > 259			return -EINVAL;
   260	
   261		spin_lock_bh(&con->outqueue_lock);
   262	
   263		while (!list_empty(queue)) {
   264			e = list_first_entry(queue, struct outqueue_entry, list);
   265			evt = &e->evt;
   266			spin_unlock_bh(&con->outqueue_lock);
   267	
   268			if (e->inactive)
   269				tipc_conn_delete_sub(con, &evt->s);
   270	
   271			memset(&msg, 0, sizeof(msg));
   272			msg.msg_flags = MSG_DONTWAIT;
   273			iov.iov_base = evt;
   274			iov.iov_len = sizeof(*evt);
   275			msg.msg_name = NULL;
   276	
   277			if (con->sock) {
   278				ret = kernel_sendmsg(con->sock, &msg, &iov,
   279						     1, sizeof(*evt));
   280				if (ret == -EWOULDBLOCK || ret == 0) {
   281					cond_resched();
   282					return;
   283				} else if (ret < 0) {
   284					return tipc_conn_close(con);
   285				}
   286			} else {
   287				tipc_topsrv_kern_evt(srv->net, evt);
   288			}
   289	
   290			/* Don't starve users filling buffers */
   291			if (++count >= MAX_SEND_MSG_COUNT) {
   292				cond_resched();
   293				count = 0;
   294			}
   295			spin_lock_bh(&con->outqueue_lock);
   296			list_del(&e->list);
   297			kfree(e);
   298		}
   299		spin_unlock_bh(&con->outqueue_lock);
   300	}
   301	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 61092 bytes
Desc: not available
URL: <http://lists.linuxfoundation.org/pipermail/linux-kernel-mentees/attachments/20200727/fb5f7407/attachment-0001.gz>


More information about the Linux-kernel-mentees mailing list