Re: [PATCH] wifi: cfg80211: fix leak if split 6 GHz scanning fails
From: Johannes Berg
Date: Thu May 28 2026 - 04:48:23 EST
On Sun, 2026-05-24 at 19:53 +0300, Fedor Pchelkin wrote:
>
> @@ -1101,7 +1102,12 @@ int cfg80211_scan(struct cfg80211_registered_device *rdev)
> rdev_req->req.scan_6ghz = false;
> rdev_req->req.first_part = true;
> rdev->int_scan_req = request;
> - return rdev_scan(rdev, request);
> + err = rdev_scan(rdev, request);
> + if (err) {
> + kfree(rdev->int_scan_req);
> + rdev->int_scan_req = NULL;
> + }
> + return err;
Given that rdev isn't accessible to the driver call in rdev_scan(), I
think it'd be nicer to do kfree(request) and defer the int_scan_req
assignment to after the rdev_scan() call?
johannes