From patchwork Mon Mar 18 18:37:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13595728 Received: from mx0b-003ede02.pphosted.com (mx0b-003ede02.pphosted.com [205.220.181.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D5E05579D for ; Mon, 18 Mar 2024 18:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.181.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710788385; cv=none; b=V3iYf0Yr3nQd7LyZllM2AYl2hXG32xbynykOZFXAs0FVGQmaM0sdyPWBk86T6Rn7xYH+oEjpRQ44QZB4VmuaIf25rLn2sAWeHpRozI6kqfbDGG95iC1AFvIhEd3jGq1bIEGoKQU0+NsGot/HvoML0gW8aT9qjylRRPVhcZxCbms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710788385; c=relaxed/simple; bh=zzHnNA+xkCpL76k9+Gmd8XMykna+lALwtXMoFvH+ctg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=JyXEt6mnCend/6aVETnaXvJ8lqU/e855i6XSUyFTXZB0rt5SXnfxcDNx34x+WNHundNCK2IX96CcCiik0wPAJJrKzysomHjTlq740mCgGGBfWKO7zLeVKItE+Kyufik84MuSad674lKYtzlCRcfD1zO6N4ZrblEMO3F+2cFiQ/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=MqPXeXsd; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=q7TRAT/B; arc=none smtp.client-ip=205.220.181.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="MqPXeXsd"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="q7TRAT/B" Received: from pps.filterd (m0286620.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42ICbku1002187 for ; Mon, 18 Mar 2024 11:38:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:mime-version:content-type; s=ppemail; bh=cs9p1cL/rZIsbibDtqAPQTWyzcPHwDtkrD7ZXGzh90Q=; b=M qPXeXsdF804U4/QswsGYuNghBjHHHgPN0yEbcmDB7uqGeHWXk4qoJJZdqRmrUyUq nA+2xzGodREFovc/yyajRZWie6qy24FfNAD6B3NC6zPdgnjzHJvr9TnmM8sHsnc+ VNVrbSiE5iK100hFYx1p4h94G43FXzOAG61dcMkekJJyXJIO5cInRFXHfAYAwQst WMcGoe3Lic3lkwgqUobhfDCJpOu6EqeZ/zfXI9QVQ9lh7tD2NaCiYJisRTZ5jXWu ieYBfP0B0tjBdrWlhpzWeQDM2imWbbbau2Sat9ULG7ou9XsB9POF0TLLwALKNokA EHZcONG3F4zExpm/u9png== Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wwayxhauv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 18 Mar 2024 11:38:17 -0700 (PDT) Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-7cbfd4781fcso304085239f.3 for ; Mon, 18 Mar 2024 11:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1710787096; x=1711391896; darn=lists.linux.dev; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=cs9p1cL/rZIsbibDtqAPQTWyzcPHwDtkrD7ZXGzh90Q=; b=q7TRAT/BdAO5X4OEdveLI2NmSm0cEV1lIK8ZiqzOqHeUOsPZopPZQfj9GjAYkVn8ZE MOGEaJQ7r1u5uOCUTgSKPU/euLTHkJMp4CTWMSRdDUfkHGLYJwMBXQyU0VsgQiC7hQYK NmMv06MKPiJ7rMg7KSFhdx/f+pDsCPh3e21uAFQq71uf65uAc4bhSh3Lb3zYFTpPyoeo NA6q1a0xkfaHwFLfXK1KVrWZDn4NIt5/JhsL3xUcJ22TCMQ1C33vcM6uZyolNWvsZOKn 2Qv26GAz3kNfMKM+tUA3SmiRwFwoozhut5aqx0Oj1bKW6H/t1FhsTor3bLiQlYJzUs/S 7bqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710787096; x=1711391896; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cs9p1cL/rZIsbibDtqAPQTWyzcPHwDtkrD7ZXGzh90Q=; b=BjcVtUeje33PHqXx8Evvs44XRm5ZvSavc/8Otgtm7k3wUCq3+ggqIK147DyhBN6Sn5 Zm2vfBSP+3V78FR06wonh509ye+8IQdEI0gKrfHXgMSGoku8Y/ngsHGjxsGMoEUjy4R5 tFv/lMX9lT9R0oGCnAB8a+lvsA365gffiavddBV7AEVWF5Nkdotwf4gy8gUF7dFIdXQm Saapx8Vs2RHSVrsQWw+fpXlQKgmSWYcoi8yDoz4uunVYPA0CPKayfzu5E9cpHTWXwMcz HaimS20ix7KBKC73MteeitfoA1SWtW6GXR/QkksFuCH9NfifsWCOCiGBeTtJILsL5zhN YXag== X-Gm-Message-State: AOJu0YwJxa4/7Zp+xUdc64jURH51fZ67p25/pfwaXHN1wUUMS8mjpZ4d fLfqc6gBLBAPstvd5un6TGWnIhx4b9HpOJdVmEHeGfYeFZkB7o8piTIU2PAM4pqVFrxMxM9Kkb8 WZ1pK4YdPp40tMGXbEhRpg0XFB8FTrfvzS+HrW82oriRfrnqNixUiF66e64w8N63vmBEy7zn9NO D7wN6A8BwkuIrCvMy0m2afVEgmnH64dku1T2MKvcyiZ0CiS3o= X-Received: by 2002:a6b:7301:0:b0:7cc:25b:55ea with SMTP id e1-20020a6b7301000000b007cc025b55eamr239969ioh.13.1710787096442; Mon, 18 Mar 2024 11:38:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG18wCNYmlAHUf8FTk5T/CTzDSyD0jxBeqH7h1u7gJaDLDM3bRdBBCMYTrBU14/hTFiu2r82Q== X-Received: by 2002:a6b:7301:0:b0:7cc:25b:55ea with SMTP id e1-20020a6b7301000000b007cc025b55eamr239948ioh.13.1710787096057; Mon, 18 Mar 2024 11:38:16 -0700 (PDT) Received: from cs-1zgl0npt-heavy-homedir-768618.corp.robot.car (133.199.192.35.bc.googleusercontent.com. [35.192.199.133]) by smtp.gmail.com with ESMTPSA id q6-20020a5d9f06000000b007cc6af6686esm873477iot.30.2024.03.18.11.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 11:38:15 -0700 (PDT) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH v2 1/3] qmi: Discover timeout could cause a crash Date: Mon, 18 Mar 2024 13:37:46 -0500 Message-ID: <20240318183754.71578-1-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: LrBWgI4bTD5fkMZSSP5nokMu5sFejVue X-Proofpoint-GUID: LrBWgI4bTD5fkMZSSP5nokMu5sFejVue X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-18_12,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 adultscore=0 clxscore=1011 spamscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403140001 definitions=main-2403180141 Sometimes the QRTR discover timeout would occur simply because the control packets are being processed slowly. Handle this by extending the timeout each time a service is discovered. Then ensure the discover data on the queue exists before processing it, just in case there was an actual timeout. --- drivers/qmimodem/qmi.c | 50 ++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 3408c32a657d..6eda68d7a571 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -43,6 +43,9 @@ #include "qmi.h" #include "ctl.h" + +#define DISCOVER_TIMEOUT 5 + typedef void (*qmi_message_func_t)(uint16_t message, uint16_t length, const void *buffer, void *user_data); @@ -1660,8 +1663,9 @@ static int qmi_device_qmux_discover(struct qmi_device *device, qmux_discover_callback, data); data->tid = __ctl_request_submit(qmux, req); - data->timeout = l_timeout_create(5, qmux_discover_reply_timeout, - data, NULL); + data->timeout = l_timeout_create(DISCOVER_TIMEOUT, + qmux_discover_reply_timeout, + data, NULL); __qmi_device_discovery_started(device, &data->super); @@ -2017,6 +2021,8 @@ static void qrtr_received_control_packet(struct qmi_device *device, const void *buf, size_t len) { const struct qrtr_ctrl_pkt *packet = buf; + struct discover_data *data; + struct qmi_service_info info; uint32_t cmd; uint32_t type; uint32_t instance; @@ -2038,14 +2044,16 @@ static void qrtr_received_control_packet(struct qmi_device *device, return; } + data = l_queue_peek_head(device->discovery_queue); + if (!packet->server.service && !packet->server.instance && !packet->server.node && !packet->server.port) { - struct discover_data *data; - DBG("Initial service discovery has completed"); - data = l_queue_peek_head(device->discovery_queue); - DISCOVERY_DONE(data, data->user_data); + if (data) + DISCOVERY_DONE(data, data->user_data); + else + DBG("discovery_queue is empty"); /* likely a timeout */ return; } @@ -2057,21 +2065,24 @@ static void qrtr_received_control_packet(struct qmi_device *device, node = L_LE32_TO_CPU(packet->server.node); port = L_LE32_TO_CPU(packet->server.port); - if (cmd == QRTR_TYPE_NEW_SERVER) { - struct qmi_service_info info; + DBG("New server: Type: %d Version: %d Instance: %d Node: %d Port: %d", + type, version, instance, node, port); - DBG("New server: Type: %d Version: %d Instance: %d Node: %d Port: %d", - type, version, instance, node, port); + memset(&info, 0, sizeof(info)); + info.service_type = type; + info.qrtr_port = port; + info.qrtr_node = node; + info.major = version; + info.instance = instance; - memset(&info, 0, sizeof(info)); - info.service_type = type; - info.qrtr_port = port; - info.qrtr_node = node; - info.major = version; - info.instance = instance; + __qmi_service_appeared(device, &info); - __qmi_service_appeared(device, &info); + if (!data) { + DBG("discovery_queue is empty"); /* likely a timeout */ + return; } + + l_timeout_modify(data->timeout, DISCOVER_TIMEOUT); } static void qrtr_received_service_message(struct qmi_device *device, @@ -2206,8 +2217,9 @@ static int qmi_device_qrtr_discover(struct qmi_device *device, l_util_hexdump(false, &packet, bytes_written, device->debug_func, device->debug_data); - data->timeout = l_timeout_create(5, qrtr_discover_reply_timeout, - data, NULL); + data->timeout = l_timeout_create(DISCOVER_TIMEOUT, + qrtr_discover_reply_timeout, + data, NULL); __qmi_device_discovery_started(device, &data->super); From patchwork Mon Mar 18 18:37:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13595721 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A599E38DD6 for ; Mon, 18 Mar 2024 18:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710787107; cv=none; b=dmJHZ/xRkPjpizfXTUDWq7sG5D/bWJQNMb6Il72EbkR9TLfbVOQ9DZkXuc0ujVMsffEviAkHIemtx+PNg/1zeSPs9mDjgs+Vx31qleiFSc/UpDBQqaaIst2CB3poGC1CpFVJleMB/DfGYnIhJvnatYYa/2DgsQGYeVE015OfKjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710787107; c=relaxed/simple; bh=cdWcAxoga41Qfm/38PFPOvQSXxSvy5vpGsDs4zdglYQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X3tcUs68N8nSisT1QtbWOS4+fY2Zpb+fZFn5CqufYRILHL2qn+7rEITDU11KPscrbnys5ordW6KCskIkjNbhRv4IhV3bnY+gwwQmC2nPxsRE5px3AS2FsNvWKegP7cvR8lUxeORX63BTBV/LyXd3mYZP9/UtykqHJapfi6hN2GM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=NIc38AJV; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=j6sKrSPn; arc=none smtp.client-ip=205.220.169.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="NIc38AJV"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="j6sKrSPn" Received: from pps.filterd (m0286616.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42IC02Jk017552 for ; Mon, 18 Mar 2024 11:38:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=ppemail; bh=vDzy2964f10ccf8CmLTNPt mGOPyQA2loK+Bn0xdfvQM=; b=NIc38AJVRppwQx2zsrwPwKt/yt7cKUQLVPttmX NmlT3pjWD5rHWVm/9hUrkuSi6NdCWcY39YqA3qas2ze4WDdq2dkjbk7JPPpw1bgq ML1C+tH2jVQFIpZdYT+ya9jpokCHjudikNdYlcSjPcIuXHXRowCVFbd563rG7E7l ejnCNtec+j7DafzCIAEMBe6hC5PIqsY3CzjngjR9yoq6IMpNjTrHvEY5wZCIDvP5 GyM/PmLAYyGGELiDvTFCVopVtEaXqZgUtWuRnYjs8qKNMAV4CUEb5kvdwvKII4Li Wf7S1ezgGm7dHKyDGXflaDTrYGGMOnzpkoTnIMpxRiQ/PHgA== Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3ww9059cdq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 18 Mar 2024 11:38:17 -0700 (PDT) Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-7c75dee76c0so343060739f.1 for ; Mon, 18 Mar 2024 11:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1710787097; x=1711391897; darn=lists.linux.dev; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=vDzy2964f10ccf8CmLTNPtmGOPyQA2loK+Bn0xdfvQM=; b=j6sKrSPnZJbauDkWajTVODuzK+8FEZL1Mlal2DNHJ0gMMejZnCdH+TvlGAKM4ymLe3 B2q9egcmA1LDUlxsW2oEV0BXXQ2Qrl/+qSwIQ7lQqw1mksyPHG0l+1ezYsCtDE6dkq92 /ZpYDmsTwvECYMgBtrOFhsA3Fz7uSrEGNmtosk+YFrK0Rr9iHXaNWdmu/RGy3AOzLKwh 6C5odF6UTZxxTnuvsbiuKTPqPgfUmvSaiM+fRCLE1dVfX3r8fX52uc7UnzfuajuFgDjy MJv6qfvSyTYycUC8rNrwlIOe4PiqU7ljBGMPrq/0Y8nRF8sVCJre8AtstiFRV9HCdd9e bJ1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710787097; x=1711391897; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vDzy2964f10ccf8CmLTNPtmGOPyQA2loK+Bn0xdfvQM=; b=iuraAosqh4ZT4oO3VyDwkdNOudSvxbwBfNgEs4nvYh3mfvCDF0FHk208WIB532sLcr SbONhJd05NtOBCh4SpdAxDBcJ7kBV87UGb4HTzclY0gttnMD+wguWWmdrfGP6l4vwePI Gag+Lg0oO0XK8nj56RIdQ7WT5jFbIC7dLwnOKoPDooz/imJnDh3hD+ibAGLWOcyLjBYk 2D1tbP5bbf+uiwhe4PFkyNGUe+MXbdubitIyrIAXsnRWT8L8qR/kPct5P3POtw+HxSZR JBAQSDxC40qtwi+P+xyEI+tXvRD0wodRIXvCyKp1Bm+ioA8kS5np2k2SeVdZ0Mrrv+yp 4dMw== X-Gm-Message-State: AOJu0YxptMEhDFh83PltWCNSqeOY7Y1qwGK5JEkiP8L94AO0DqAv/2FC lVTlUl+J3E8ncI3ZqMdK9PEKPTOFRLS+wK8GY58pH7IvEbJEqfAEjFCG6YB08pBaXVutAE5Si7w /kylbS6e1O9fZogXrZNhKUwNLh5efc0xu3iFBzTuKGSNHI36cT6B1Zpvs4G5BGhAfW2JNPFr5nW ISxLktyEbLBGIIYAl93ZEHKlSeyWo5S6St+Nt1BQ6Qt3qTm3Q= X-Received: by 2002:a6b:f704:0:b0:7cb:fc25:4ac8 with SMTP id k4-20020a6bf704000000b007cbfc254ac8mr549318iog.7.1710787096727; Mon, 18 Mar 2024 11:38:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHT4lhAGmJdrxpsjKZK7gZYzffH5gZhnAxsmbQZMK8Bp6ePo9zBtZb25OvL70d0F7ozsLZetg== X-Received: by 2002:a6b:f704:0:b0:7cb:fc25:4ac8 with SMTP id k4-20020a6bf704000000b007cbfc254ac8mr549298iog.7.1710787096374; Mon, 18 Mar 2024 11:38:16 -0700 (PDT) Received: from cs-1zgl0npt-heavy-homedir-768618.corp.robot.car (133.199.192.35.bc.googleusercontent.com. [35.192.199.133]) by smtp.gmail.com with ESMTPSA id q6-20020a5d9f06000000b007cc6af6686esm873477iot.30.2024.03.18.11.38.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 11:38:16 -0700 (PDT) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH v2 2/3] qmi: Fix printing the wrong type for services Date: Mon, 18 Mar 2024 13:37:47 -0500 Message-ID: <20240318183754.71578-2-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240318183754.71578-1-steve.schrock@getcruise.com> References: <20240318183754.71578-1-steve.schrock@getcruise.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: _duT151oyWJ8BwgycPSY93IBF4w3yuy0 X-Proofpoint-ORIG-GUID: _duT151oyWJ8BwgycPSY93IBF4w3yuy0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-18_12,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403140001 definitions=main-2403180141 The __debug_msg refactoring introduced a bug where the service transactions would not display the correct type in the log. The service transaction type is shifted to the left by one bit compared to the control transaction type so we need to perform a shift to be able to share a common debug logging function. Fixes: afa96ae4fa99 ("qmi: Clean up the __debug_msg function") --- drivers/qmimodem/qmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 6eda68d7a571..555a4afe562e 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -648,7 +648,7 @@ static void __qmux_debug_msg(const char dir, const void *buf, size_t len, srv = buf + QMI_MUX_HDR_SIZE; msg = buf + QMI_MUX_HDR_SIZE + QMI_SERVICE_HDR_SIZE; - transaction_type = srv->type; + transaction_type = srv->type >> 1; tid = L_LE16_TO_CPU(srv->transaction); } @@ -672,7 +672,7 @@ static void __qrtr_debug_msg(const char dir, const void *buf, size_t len, tid = L_LE16_TO_CPU(srv->transaction); - __debug_msg(dir, msg, service_type, srv->type, tid, 0, len, + __debug_msg(dir, msg, service_type, srv->type >> 1, tid, 0, len, function, user_data); } From patchwork Mon Mar 18 18:37:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13595729 Received: from mx0b-003ede02.pphosted.com (mx0b-003ede02.pphosted.com [205.220.181.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D5B04779F for ; Mon, 18 Mar 2024 18:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.181.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710788385; cv=none; b=qaK8s8XUndydVSIKy7UxAkbkwyePmdsQ/HIIQaoZKo1e6bQzrg6IwLwNS2MRZAEEPbYDtEHakmftQH3IcRAr95UGNs8xVudaFt4bx0MPsokKdpc1aqYboiZ4rWSOcxqE2S54P1/9aAGJpyYbV3jinQhqdvMJUSp/7oTL9lhXkZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710788385; c=relaxed/simple; bh=P8/6TIhpY7GrfzPRSWwhmEzetFGcJPJ7InI4IXl3pQE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bOHxGMiEnBwCqQ8WiUoBWuUV0sf+V/jC65xolVY2bzwjFoXXLmqwNzjBFbBgpg22/+fhZPZ00Ne4gCjpmMO0xXrUa2nmfMPqSeLUWvPeC+RQmhiPtL9y1AIRYhlMu7YBeVaoPa9x9FMLdsIraiu5YkiAxFKWvrZho1Fav/JKElk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=I9plU53l; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=aymOEc14; arc=none smtp.client-ip=205.220.181.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="I9plU53l"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="aymOEc14" Received: from pps.filterd (m0286620.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42IFm4S1001710 for ; Mon, 18 Mar 2024 11:38:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=ppemail; bh=KNaobGxm2ddtlWeAKK2x5B AYGK8ycGuGUHr1miMT/2A=; b=I9plU53lHEK1Qk48LG5pdDcwnhHxv7d5ou87+4 E2Ie9hjX8Go5u7EWyiisGpq0pMY0Hf2Jpyv1qLuK+CiO6RsiAvnqstCS4cc6nPkz +IPMbph8DI3v1mQyNbZuXDfpMBw36sJPf2aYJ1vRz75idTaieqUW0J5oX7nJ2SfP gNlWiZ+IAdEdZwOOSQg5tyou95Bxv4l94bLQhbaA8zLLfZ3W7G9w6OfMTrsDxLFu RzI1Z8CzcHGEiGDM7tmvZkI6/PtdT1G9c+2AUZeePi17u7QbpK8HGKDePgpGJJaA oqXbV9Za998E8U8DwW9EsTTvKhQABNPY/uJNvosJtN/rS2Vg== Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wwayxhauw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 18 Mar 2024 11:38:18 -0700 (PDT) Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-7cbf2ff0e33so382797239f.1 for ; Mon, 18 Mar 2024 11:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1710787097; x=1711391897; darn=lists.linux.dev; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=KNaobGxm2ddtlWeAKK2x5BAYGK8ycGuGUHr1miMT/2A=; b=aymOEc14GAJdBzY5nnKbgJW72h8gJ4SJiVXaC4lwIq08Vk7R0N8ozaqqpmX7VzOAs2 ja9k4gokvpd9DDehqXsPOygunqGuuyCicrVbG0tTiYmZYrGL8raeC6Lyr3vrwttQoO2v 9sOb50DkxmlbQGIgfcEwFu3uwV0oRzGPvDZy7q58SSbIF53qDePIoaDaRmzXRW77aVmZ K5rUIHui2NBHwiFWfKmq++rkPuNR1CjRsqMoFuY97QLz9w7b44XAuefux+adprI4dt+5 48HAWZo+MbuBkTTR3c220GWzWcUshFxQql4reBoDdzz6JZSZ+z9fzpVkIEWeqVK2QgzW jmiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710787097; x=1711391897; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KNaobGxm2ddtlWeAKK2x5BAYGK8ycGuGUHr1miMT/2A=; b=wVYCp21zk8/yfc6ziGR72jz54+GUug923h82mFS6kgfvzI7bOVkJQPW5gdUW7Q/FrG DDLmGLCTsU0FCxPojuQs4tWGAIYwO7rzbGcVQAMGar65nY6LA3d9JnMZAx1m1fY1YvU0 EVLN9b0Lw592/8qjnBqPPBO9LXId2D5E14LW1dXsMz5E7V6dfcQSGJXuASRLzlvRZYyn Qa0TYeOK3ff5oWOnC8GeHSZ5Uzj3+QSAL3HHfSZsd9LJqQzeaqHHCQRRddtEwk29OHjN n8lo0t1lt5+bBhOT1Q6YD6msWD8aKpUXp/x+//mbd0D5rSYDeL9P2FtkryGZxXR89Hkz u2WQ== X-Gm-Message-State: AOJu0Yz11RiPd13eZO5VtcY1AdJ7MkdL5Z+j2Rh+UvlQE3iBU2gwbGOv Ijifvsfl/+x7stXNZwBdQCEjw9igkdrPnorM7D1gli619QhMavTjrr0hTUNHOp5unEHMBsLT+c0 h/2Yjt+MWot25ya8PO8sG5zKFYrRMNljUvW73qxTXSteedt794VlFMQlIdOQLLW+jT0zDXtjTTD 8PYaUe5e/QbkcsQ8XzQjtjVl98yAdFvn3HNmRiu6rQQxU/TrM= X-Received: by 2002:a5d:9591:0:b0:7c8:e934:5cca with SMTP id a17-20020a5d9591000000b007c8e9345ccamr12728558ioo.15.1710787097046; Mon, 18 Mar 2024 11:38:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGMKacoZZCyA93JJeaoaQ4oHqOVQB8lvVv9ncc2HYP4eWJY16ThN919l0Vx0gWWCKtD/u4DQ== X-Received: by 2002:a5d:9591:0:b0:7c8:e934:5cca with SMTP id a17-20020a5d9591000000b007c8e9345ccamr12728539ioo.15.1710787096694; Mon, 18 Mar 2024 11:38:16 -0700 (PDT) Received: from cs-1zgl0npt-heavy-homedir-768618.corp.robot.car (133.199.192.35.bc.googleusercontent.com. [35.192.199.133]) by smtp.gmail.com with ESMTPSA id q6-20020a5d9f06000000b007cc6af6686esm873477iot.30.2024.03.18.11.38.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 11:38:16 -0700 (PDT) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH v2 3/3] qmi: Allow QRTR services to be destroyed Date: Mon, 18 Mar 2024 13:37:48 -0500 Message-ID: <20240318183754.71578-3-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240318183754.71578-1-steve.schrock@getcruise.com> References: <20240318183754.71578-1-steve.schrock@getcruise.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: K2Y5zyYx-FFl8hlGIaTEl1axz8TYUPiB X-Proofpoint-GUID: K2Y5zyYx-FFl8hlGIaTEl1axz8TYUPiB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-18_12,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 adultscore=0 clxscore=1015 spamscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 phishscore=0 suspectscore=0 mlxlogscore=792 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403140001 definitions=main-2403180141 QRTR services were never being destroyed because they were being created with a reference count of 1 and immediately incrementing the count to 2. --- drivers/qmimodem/qmi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 555a4afe562e..69a28afd1a2a 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -2582,7 +2582,8 @@ bool qmi_service_create_shared(struct qmi_device *device, uint16_t type, service = service_create(device, info, 0); l_hashmap_insert(device->service_list, L_UINT_TO_PTR(type_val), service); - } + } else + service = qmi_service_ref(service); data = l_new(struct service_create_shared_data, 1); @@ -2591,8 +2592,8 @@ bool qmi_service_create_shared(struct qmi_device *device, uint16_t type, data->func = func; data->user_data = user_data; data->destroy = destroy; + data->service = service; - data->service = qmi_service_ref(service); data->idle = l_idle_create(service_create_shared_reply, data, NULL);