From nobody Fri Jan 21 17:33:17 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CAB281958D1E for ; Fri, 21 Jan 2022 17:33:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JgRL53xLXz4V8r for ; Fri, 21 Jan 2022 17:33:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6784B1FD46 for ; Fri, 21 Jan 2022 17:33:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 20LHXHgu091520 for ; Fri, 21 Jan 2022 17:33:17 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 20LHXHts091519 for bugs@FreeBSD.org; Fri, 21 Jan 2022 17:33:17 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 261387] Should cam be calling callout drain for struct cam_sim and struct cam_ed? Date: Fri, 21 Jan 2022 17:33:17 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: Herbie.Robinson@stratus.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642786397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JRik8KEBk0EGUmuErqvxlB0YWhSbOKtFWcgxkGrMWC0=; b=b/T+/Bm5JuNLwJFh5ul70N6e56RW6QrYJ1ARkWz+BsOAGhTW+6tK2Gwc+OqoUzZi6c/Wgu al+A7z5yRHxxHnYexl9qRMbgKjiWHOaZio0PR9GeiiMDjSa7OI+I8hSEwfChI0XMuK6/VU rTjHlKMr1NSu9VWa3NjY+LlyNIkRJyn+43KPWGJTVUFPa2mzGuhqlDaXlTRBHP061JHi+u RgxdYniAjVeaP+WndXMJpNacFpcCHqyf0mifsZgjXLF/MJbU85bbjTvo7tZbvzzo4G/Dqs 9/88vNZ+hwuvSV95zwFdN2Lkdqplm/9INuChlrjYJhocDZTBVibZnCbdSWIFBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642786397; a=rsa-sha256; cv=none; b=TodFI1XG8sM4rrnr89CZ7q48J2e1w+ZkxEU9wKU3L7gcXLgZRkqKsbtJWzkVfEnIwRblGa XbuY/WItswvZLWCq/QOY6aVjJensG+yixVGclPeEWTLchnmn5VjdkBHDUGhn4e4gRfPG/B VVvtyNSypScwLwfG/NuoMjXe+44F1BHR62JMff9T9J1zuy7gmuaPQ44Ad6wEzHRFvZOVkf +sPxnQWpY1OLfAXfn24f0qVgQNBUe/VbiFRDwVSpUGW6gi0VqWUShrNwOzMu9O5yS81RFk 3vXMYScI28IESCb2qPq4QM4Uz8iDSREsej+whSoR6fukyZXF5Bl1p3Gnd44zMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261387 Bug ID: 261387 Summary: Should cam be calling callout drain for struct cam_sim and struct cam_ed? Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: Herbie.Robinson@stratus.com The documentation for callout says that callout_drain must be called before destroying any storage containing a callout structure. I noticed the CAM doesn't do that for struct cam_sim and struct cam_id. I pose this bug report as a question, because it does seem a little scary to fix it and it's certainly beyond my level of experience with the FreeBSD kernel. The simple patches to fix this would be --- cam_sim.c +++ cam_sim.c @@ -165,6 +165,7 @@ if (free_devq) cam_simq_free(sim->devq); + callout_drain(&sim->callout); free(sim, M_CAMSIM); } --- cam_xpt.c +++ cam_xpt.c @@ -4831,6 +4831,7 @@ { struct cam_ed *device =3D context; + callout_drain(&device->callout); mtx_lock(&device->device_mtx); mtx_destroy(&device->device_mtx); free(device, M_CAMDEV); This is relative to the main branch https://cgit.freebsd.org/src/commit/?id=3Db252fb24301c1f7e7d83eab631e7d9fa9= 47e227d. The routines patched are cam_sim_free and xpt_destroy_device. --=20 You are receiving this mail because: You are the assignee for the bug.=