From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225xVsFIOzjvqNsNdydYJgFt+OjXirUwlh4sfelag8Fpo41Ic4C/ljlQU4Tg5QpLG23+a3xj ARC-Seal: i=1; a=rsa-sha256; t=1517256785; cv=none; d=google.com; s=arc-20160816; b=UbR6q3Y6qhYYeKvmNoRx1zVVdDD9uLHUM2ZCG9iVkUMMooYHneK3NRfErPIjG4Gtdx JH9xywCZuNwi2+o4BBmAuCHLaQsfOwwu6S00dgzTQA4Qm3TEAGnCk5EeGW71zHRkWjUE PNUubrAPXo1TDUVeXmX+xF2eOl6qB/cE+udABJEV8EYz8A7dP4nGMnTWqQamVbjP//ms Uews5CCFFAsSQhBGwNhj1HhkZq0MPatW0tSjdo3FU/GYaD2FgvoH5DU2TIFq0oMCHmKe oSRaeI1NvYmYWSSlOEZ7qGlmT/jj0PR86FNOKbW0rU9w6KCFCLM9F4ElnZwga18iN9OV EtKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=+X8Yxnxpg2Z7G0T4g8SGP6KP2Vn5BORP3HwtA/1aZxs=; b=kgjz2LfdwbZaZNXBMjcRGkG/QLa4DrqfiLKM1d+h1C4U4rEnjhAoko3B4kIo0dfZbg b20VR2Ynm+evadx6FcZCxjz7dathj20XCOFvcqt0HJFLZ+4rejVn6CHXYuEruibne786 aKq069pv1iRh0ujsk2Yyc9cMsi8y+jLlu+mbg1tATqz5xyAKae355mhQnKABp/PPfNpW 4GppNY3ic+2ZZthd3DSXrFhxpX8XK6HnpH8eUU1aCXyJgHv3NEirHtcT0NF7zSOIo8RG K6jV99pzDbMZvhjwqEyqQsuOJPfZqIdGsNwwHH8hZRrbK2gI1nw3VpR+MtRcI8tWq4Vo +vyA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Westfall , "David S. Miller" Subject: [PATCH 4.9 47/66] net: Allow neigh contructor functions ability to modify the primary_key Date: Mon, 29 Jan 2018 13:57:11 +0100 Message-Id: <20180129123842.361195059@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123839.842860149@linuxfoundation.org> References: <20180129123839.842860149@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958529601343755?= X-GMAIL-MSGID: =?utf-8?q?1590959050862070110?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jim Westfall [ Upstream commit 096b9854c04df86f03b38a97d40b6506e5730919 ] Use n->primary_key instead of pkey to account for the possibility that a neigh constructor function may have modified the primary_key value. Signed-off-by: Jim Westfall Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/neighbour.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -496,7 +496,7 @@ struct neighbour *__neigh_create(struct if (atomic_read(&tbl->entries) > (1 << nht->hash_shift)) nht = neigh_hash_grow(tbl, nht->hash_shift + 1); - hash_val = tbl->hash(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift); + hash_val = tbl->hash(n->primary_key, dev, nht->hash_rnd) >> (32 - nht->hash_shift); if (n->parms->dead) { rc = ERR_PTR(-EINVAL); @@ -508,7 +508,7 @@ struct neighbour *__neigh_create(struct n1 != NULL; n1 = rcu_dereference_protected(n1->next, lockdep_is_held(&tbl->lock))) { - if (dev == n1->dev && !memcmp(n1->primary_key, pkey, key_len)) { + if (dev == n1->dev && !memcmp(n1->primary_key, n->primary_key, key_len)) { if (want_ref) neigh_hold(n1); rc = n1;